diff options
Diffstat (limited to '')
-rw-r--r-- | šola/p1/dn/DN03_63230317.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/šola/p1/dn/DN03_63230317.java b/šola/p1/dn/DN03_63230317.java new file mode 100644 index 0000000..18ab302 --- /dev/null +++ b/šola/p1/dn/DN03_63230317.java @@ -0,0 +1,42 @@ +import java.util.*; +public class DN03_63230317 { + public static void main (String[] args) { + Scanner sc = new Scanner(System.in); + long h = sc.nextInt(); + long w = sc.nextInt(); + long k = sc.nextInt(); + if (w < h) { // a je to res potrebno + w += h; + h = w-h; + w -= h; + } + long sum = 0; + for (long i = 0; i < k; i++) + if ((w & (1 << i)) > 0) { + long add = h/(1 << i); + if (System.getenv("DN03_DEBUG") != null) + System.err.println("po širini: i == " + i + ". dodal bom " + add); + sum += add; + } + { + long add = (w/(1 << k))*(h/(1 << k)); + if (System.getenv("DN03_DEBUG") != null) + System.err.println("dodal bom " + add + " največjih"); + sum += add; + } + for (long i = 0; i < k; i++) { + if ((h & (1 << i)) > 0) { + long add = w/(1 << i); + if (System.getenv("DN03_DEBUG") != null) + System.err.println("po višini: i == " + i + ". dodal bom " + add); + sum += add; + if ((w & (1 << i)) > 0) { + if (System.getenv("DN03_DEBUG") != null) + System.err.println(w + " je skupen, odstranjujem eno"); + sum--; + } + } + } + System.out.println(sum); + } +} |