@WangYixu
2018-06-15T11:35:50.000000Z
字数 625
阅读 569
OI 题解 数论 数学
这里做了一个小改动:直接分解
本来还打了素数表,不知道为什么WA了
#include<cstdio>#include<cstring>#define ll long longconst int N = (1 << 20) + 10;ll l[N], g[N];ll L, G;inline void factor() {memset(g, 0, sizeof(g));memset(l, 0, sizeof(l));if (L % G) {printf("0\n");return;}ll ans = 1;L /= G;for (register int i = 2; L > 1; ++i) {int cnt = 0;while (L % i == 0 && L > 1) {L /= i;cnt++;}if (cnt) ans *= 6 * cnt;}printf("%d\n", ans);}int main() {int n;scanf("%d", &n);while (n--) {scanf("%lld %lld", &G, &L);factor();}return 0;}
