用户输出
6
1
9999999966
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#81528 | #1304. zxh的派系共识 | Accepted | 100 | 149 ms | 492 K | C++ 11 (Clang) / 609 B | 15291309895 | 2022-11-14 16:25:50 |
#include <bits/stdc++.h>
typedef long long ll;
ll GetPhi(ll num) {
ll phi = num;
if (num == 1)
return 1;
for (ll i = 2; i * i <= num; i++) {
if (num % i == 0) {
phi = phi / i * (i - 1);
while (num % i == 0) num /= i;
}
}
if (num > 1)
phi = phi / num * (num - 1);
return phi;
}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll T;
int main() {
scanf("%lld", &T);
for (ll i = 0, a, m; i < T; i++) {
scanf("%lld %lld", &a, &m);
printf("%lld\n", GetPhi(m / gcd(a, m)));
}
return 0;
}
用户输出
6
1
9999999966
系统信息
Exited with return code 0
用户输出
1
2
2
4
1
6
4
6
4
10
系统信息
Exited with return code 0
用户输出
12
52
2
40
2
18
28
58
2
60
系统信息
Exited with return code 0
用户输出
32
102
48
8
52
106
18
108
10
72
系统信息
Exited with return code 0
用户输出
72
16
60
120
24
156
78
52
16
132
系统信息
Exited with return code 0
用户输出
100
168
32
40
102
132
96
180
48
210
系统信息
Exited with return code 0
用户输出
36
220
126
128
128
256
84
216
96
168
系统信息
Exited with return code 0
50
5882304938 9999763901
9505722760 9999966511
5805364980 9999170087
9810619921 9999771101
5506
<1048 bytes omitted>
9999563904
9999766512
9998970096
9999571104
9998374464
9998975376
9998581824
9999783360
9998
<500 bytes omitted>
用户输出
9999563904
9999766512
9998970096
9999571104
9998374464
9998975376
9998581824
9999783360
9998386608
9998787040
9996793200
9997393
<422 bytes omitted>
系统信息
Exited with return code 0
50
6891776487 9999998023
4734215850 9999998027
3759181425 9999998083
3605139012 9999998123
3468
<1047 bytes omitted>
9999998022
9999998026
9999998082
9999998122
9999998136
9999998146
9999998148
9999998158
9999
<500 bytes omitted>
用户输出
9999998022
9999998026
9999998082
9999998122
9999998136
9999998146
9999998148
9999998158
9999998190
9999998230
9999998232
9999998
<422 bytes omitted>
系统信息
Exited with return code 0
50
3196991747 7556064528
1046365130 8269632992
610034468 4621492906
5332350866 6827878205
27612
<1024 bytes omitted>
2370525696
2067408240
2279092320
5453181136
5654536848
1899912960
420206400
1159047360
31260
<483 bytes omitted>
用户输出
2370525696
2067408240
2279092320
5453181136
5654536848
1899912960
420206400
1159047360
3126014640
198097920
1647682560
398097504
<405 bytes omitted>
系统信息
Exited with return code 0
50
3235271017 5751345600
6117973023 6299092800
650281279 6518191680
5197907098 6616209600
34383
<1045 bytes omitted>
104509440
364953600
1114767360
597196800
18247680
8257536
11197440
1393459200
681246720
232
<431 bytes omitted>
用户输出
104509440
364953600
1114767360
597196800
18247680
8257536
11197440
1393459200
681246720
232243200
91238400
6082560
774144000
541
<353 bytes omitted>
系统信息
Exited with return code 0
50
6983776799 6983776800
6983776799 6983776800
6983776799 6983776800
6983776799 6983776800
6983
<1052 bytes omitted>
1194393600
1194393600
1194393600
1194393600
1194393600
1194393600
1194393600
1194393600
1194
<500 bytes omitted>
用户输出
1194393600
1194393600
1194393600
1194393600
1194393600
1194393600
1194393600
1194393600
1194393600
1194393600
1194393600
1194393
<422 bytes omitted>
系统信息
Exited with return code 0
50
9311702399 9311702400
9311702399 9311702400
9311702399 9311702400
9311702399 9311702400
9311
<1052 bytes omitted>
1592524800
1592524800
1592524800
1592524800
1592524800
1592524800
1592524800
1592524800
1592
<500 bytes omitted>
用户输出
1592524800
1592524800
1592524800
1592524800
1592524800
1592524800
1592524800
1592524800
1592524800
1592524800
1592524800
1592524
<422 bytes omitted>
系统信息
Exited with return code 0
50
240158472 240160776
240155112 240160776
240040824 240160776
240040968 240160776
240063864 24
<894 bytes omitted>
10006698
10006698
10006698
10006698
10006698
19260816
10006698
10006698
10006698
10006698
<397 bytes omitted>
用户输出
10006698
10006698
10006698
10006698
10006698
19260816
10006698
10006698
10006698
10006698
10006602
10006602
10006602
10006602
19
<319 bytes omitted>
系统信息
Exited with return code 0
50
10006603 10006699
10006463 10006699
10001701 10006699
10001707 10006699
10002661 10006699
1
<764 bytes omitted>
10006698
10006698
10006698
10006698
10006698
19260816
10006698
10006698
10006698
10006698
<397 bytes omitted>
用户输出
10006698
10006698
10006698
10006698
10006698
19260816
10006698
10006698
10006698
10006698
10006602
10006602
10006602
10006602
19
<319 bytes omitted>
系统信息
Exited with return code 0
50
5123380736 5123429888
5123309056 5123429888
5120870912 5123429888
5120873984 5123429888
5121
<994 bytes omitted>
10006698
10006698
10006698
10006698
10006698
19260816
10006698
10006698
10006698
10006698
<397 bytes omitted>
用户输出
10006698
10006698
10006698
10006698
10006698
19260816
10006698
10006698
10006698
10006698
10006602
10006602
10006602
10006602
19
<319 bytes omitted>
系统信息
Exited with return code 0
50
2431604529 2431627857
2431570509 2431627857
2430413343 2431627857
2430414801 2431627857
2430
<994 bytes omitted>
10006698
10006698
10006698
10006698
10006698
19260816
10006698
10006698
10006698
10006698
<397 bytes omitted>
用户输出
10006698
10006698
10006698
10006698
10006698
19260816
10006698
10006698
10006698
10006698
10006602
10006602
10006602
10006602
19
<319 bytes omitted>
系统信息
Exited with return code 0
50
1200792360 1200803880
1200775560 1200803880
1200204120 1200803880
1200204840 1200803880
1200
<978 bytes omitted>
10006698
10006698
10006698
10006698
10006698
19260816
10006698
10006698
10006698
10006698
<397 bytes omitted>
用户输出
10006698
10006698
10006698
10006698
10006698
19260816
10006698
10006698
10006698
10006698
10006602
10006602
10006602
10006602
19
<319 bytes omitted>
系统信息
Exited with return code 0
50
1250825375 1250837375
1250807875 1250837375
1250212625 1250837375
1250213375 1250837375
1250
<978 bytes omitted>
10006698
10006698
10006698
10006698
10006698
19260816
10006698
10006698
10006698
10006698
<397 bytes omitted>
用户输出
10006698
10006698
10006698
10006698
10006698
19260816
10006698
10006698
10006698
10006698
10006602
10006602
10006602
10006602
19
<319 bytes omitted>
系统信息
Exited with return code 0
50
2501650750 2501674750
2501615750 2501674750
2500425250 2501674750
2500426750 2501674750
2500
<994 bytes omitted>
10006698
10006698
10006698
10006698
10006698
19260816
10006698
10006698
10006698
10006698
<397 bytes omitted>
用户输出
10006698
10006698
10006698
10006698
10006698
19260816
10006698
10006698
10006698
10006698
10006602
10006602
10006602
10006602
19
<319 bytes omitted>
系统信息
Exited with return code 0