diff options
Diffstat (limited to 'šola/p1/dn/Plo.java')
-rw-r--r-- | šola/p1/dn/Plo.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/šola/p1/dn/Plo.java b/šola/p1/dn/Plo.java new file mode 100644 index 0000000..32a708f --- /dev/null +++ b/šola/p1/dn/Plo.java @@ -0,0 +1,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); + } +} |