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