记录编号 357565 评测结果 AAAAAAAAAA
题目名称 [NOI 2010]能量采集 最终得分 100
用户昵称 Gravatarsxysxy 是否通过 通过
代码语言 C++ 运行时间 0.011 s
提交时间 2016-12-11 15:31:23 内存使用 1.05 MiB
显示代码纯文本
  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include <cstdarg>
  4. #include <cstring>
  5. #include <list>
  6. #include <queue>
  7. #include <vector>
  8. #include <algorithm>
  9. #include <cmath>
  10. using namespace std;
  11. #define MAXN 100002
  12. typedef long long LL;
  13. LL d[MAXN];
  14. typedef long long LL;
  15. int main()
  16. {
  17. freopen("energy2010.in", "r", stdin);
  18. freopen("energy2010.out", "w", stdout);
  19. LL n, m;
  20. scanf("%lld %lld", &n, &m);
  21. LL sum = 0;
  22. if(n > m)swap(n, m);
  23. for(int i = (int)n; i; i--)
  24. {
  25. d[i] = (n/i)*(m/i);
  26. for(int j = i<<1; j <= n; j += i)d[i] -= d[j]; //斥
  27. sum += d[i]*(2ll*i-1);
  28. }
  29. printf("%lld\n", sum);
  30. return 0;
  31. }