blob: 32a708fc0a76ce8ffc262b9a6cc83981047c9035 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import java.util.*;
public class Plo{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long visina = sc.nextInt();
long sirina = sc.nextInt();
long k = sc.nextInt();
long stPloscic = (visina/(1 << k))*(sirina/(1 << k));
for (long i = k - 1; i >= 0; i--) {
if ((sirina & (1 << i)) > 0)
stPloscic += (visina / (1 << i));
if ((visina & (1 << i)) > 0)
stPloscic += (sirina / (1 << i));
if ((sirina & (1 << i)) > 0 && (visina & (1 << i)) > 0)
stPloscic--;
}
System.out.println(stPloscic);
}
}
|