fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. static const uint32_t MOD = (1u << 30);
  5.  
  6. uint32_t divisors_count(uint64_t n) {
  7. static unordered_map<uint64_t, uint32_t> memo;
  8. auto it = memo.find(n);
  9. if (it != memo.end()) return it->second;
  10.  
  11. uint64_t m = n;
  12. uint32_t ans = 1;
  13. for (uint64_t p = 2; p * p <= m; ++p) {
  14. if (m % p == 0) {
  15. int e = 0;
  16. while (m % p == 0) { m /= p; ++e; }
  17. ans = (uint64_t)ans * (e + 1) % MOD;
  18. }
  19. }
  20. if (m > 1) ans = (uint64_t)ans * 2 % MOD;
  21.  
  22. memo[n] = ans;
  23. return ans;
  24. }
  25.  
  26. int main() {
  27. ios::sync_with_stdio(false);
  28. cin.tie(nullptr);
  29.  
  30. long long a, b, c;
  31. if (!(cin >> a >> b >> c)) return 0;
  32.  
  33. uint32_t res = 0;
  34.  
  35. if (a > b) swap(a, b);
  36. if (b > c) swap(b, c);
  37. if (a > b) swap(a, b);
  38.  
  39. for (long long x = 1; x <= a; ++x) {
  40. for (long long y = 1; y <= b; ++y) {
  41. uint64_t xy = (uint64_t)x * (uint64_t)y;
  42. for (long long z = 1; z <= c; ++z) {
  43. uint64_t n = xy * (uint64_t)z;
  44. res += divisors_count(n);
  45. }
  46. }
  47. }
  48.  
  49. cout << (res & (MOD - 1)) << '\n';
  50. return 0;
  51. }
Success #stdin #stdout 0.01s 5288KB
stdin
2 2 2
stdout
20