求
文章图片
1?≤?a,?b,?c?≤?2000
文章图片
文章图片
【codeforces|【CF 235E】Number Challenge】
#include
#include
#include
#include
#include
#define Rep(i, x, y) for (int i = x;
i <= y;
i ++)
#define Dwn(i, x, y) for (int i = x;
i >= y;
i --)
#define RepE(i, x) for(int i = pos[x];
i;
i = g[i].nex)
using namespace std;
typedef long long LL;
const int N = 2005, M = N * N, mod = 1073741824;
int A, B, C, mu[M], pri[M], pz, num[M], ab;
LL f[M], ans;
bool c[M];
void Pre() {
mu[1] = 1;
Rep(i, 2, C) {
if (!c[i]) pri[++ pz] = i, mu[i] = -1;
Rep(j, 1, pz) {
int k = pri[j] * i;
if (k > ab) break ;
c[k] = 1, mu[k] = -mu[i];
if (i % pri[j] == 0) { mu[k] = 0;
break ;
}
}
}
Rep(e, 1, C) {
LL k = 0;
Rep(d, 1, C) k += C / (e * d);
for (int g = e;
g <= ab;
g += e) f[g] += mu[e] * k;
}
Rep(g, 1, ab) f[g] %= mod;
}
int main()
{
scanf ("%d%d%d", &A, &B, &C);
Rep(i, 1, A) Rep(j, 1, B) num[i * j] ++;
ab = A * B;
Pre();
// puts("fin");
Rep(g, 1, ab) if (num[g]) {
LL k1 = 0;
Rep(j, 1, ab / g) (k1 += num[j * g]) %= mod;
(ans += f[g] * k1) %= mod;
}
cout << ((ans + mod) % mod) << endl;
return 0;
}
推荐阅读
- AIoT(人工智能+物联网)|程序员的数学【线性代数基础】
- codeforces B. Young Explorers
- codeforces C. Mere Array
- codeforces D. Omkar and Bed Wars
- codeforces C. Omkar and Waterslide
- codeforces B. Omkar and Infinity Clock
- codeforces B. Ternary Sequence
- topcoder|Topcoder SRM 661 Div1 Easy: MissingLCM
- HDU 5184 Brackets (卡特兰数)
- 题库-CF|【Codeforces Round 370 (Div 2) E】【线段树 等比数列 区间合并】Memory and Casinos 赌场区间[l,r] l进r先出的概率