fork(2) download
  1. import java.util.Map;
  2. import java.util.Scanner;
  3. import java.io.OutputStream;
  4. import java.io.IOException;
  5. import java.util.Arrays;
  6. import java.io.PrintWriter;
  7. import java.util.HashMap;
  8. import java.io.InputStream;
  9.  
  10. /**
  11.  * Built using CHelper plug-in
  12.  * Actual solution is at the top
  13.  * @author aajjbb
  14.  */
  15. public class Main {
  16. public static void main(String[] args) {
  17. InputStream inputStream = System.in;
  18. OutputStream outputStream = System.out;
  19. Scanner in = new Scanner(inputStream);
  20. PrintWriter out = new PrintWriter(outputStream);
  21. EasyNumberChallenge solver = new EasyNumberChallenge();
  22. solver.solve(1, in, out);
  23. out.close();
  24. }
  25. }
  26.  
  27. class EasyNumberChallenge {
  28. public void solve(int testNumber, Scanner in, PrintWriter out) {
  29. int a = in.nextInt(), b = in.nextInt(), c = in.nextInt();
  30. Map<Triplet, Long> map = new HashMap<Triplet, Long>();
  31. long ans = 0L;
  32. for(int i = 1; i <= a; i++) {
  33. for(int j = 1; j <= b; j++) {
  34. for(int k = 1; k <= c; k++) {
  35. Triplet now = new Triplet(i, j, k);
  36. if(map.containsKey(now)) {
  37. ans += map.get(now);
  38. } else {
  39. long tmp = countDiv(i*j*k);
  40. map.put(now, tmp);
  41. ans += tmp;
  42. }
  43. }
  44. }
  45. }
  46. out.println(ans);
  47. }
  48. public long countDiv(long n) {
  49. if(n == 1L) return 1L;
  50.  
  51. int x = (int) Math.sqrt(n);
  52. int counter = 0;
  53.  
  54. for(int i = 1; i <= x; i++) {
  55. if(n % i == 0) {
  56. counter += 2;
  57. }
  58. }
  59. if(x * x == n) counter -= 1;
  60. return counter;
  61. }
  62. class Triplet {
  63. public int a, b, c;
  64.  
  65. public Triplet(int a1, int b1, int c1) {
  66. int[] tmp = {a1, b1, c1};
  67. Arrays.sort(tmp);
  68. a = tmp[0]; b = tmp[1]; c = tmp[2];
  69. }
  70.  
  71. @Override
  72. public boolean equals(Object o) {
  73. Triplet triplet = (Triplet) (o);
  74. return (this.a == triplet.a) && (this.b == triplet.b) && (c == triplet.c);
  75. }
  76. }
  77. }
Success #stdin #stdout 0.57s 216064KB
stdin
91 42 25
stdout
3076687