用户输出
2
1000 32000
32000 1000
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#22953 | #1125. zxh的国土无双 | Accepted | 100 | 539 ms | 436 K | C++ 17 / 1.5 K | Leohh | 2020-02-15 18:07:57 |
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <set>
#define MAX_P 105
#define pii pair<int, int>
#define int long long
using namespace std;
int G, L, tot = 0;
int a[MAX_P];
int p1[MAX_P], p2[MAX_P];
int pw[MAX_P][MAX_P];
set<pii> st;
signed main() {
scanf("%lld%lld", &G, &L);
int t = L;
for (int i = 2; i * i <= L; i++) {
if (!(t % i)) {
a[++tot] = i;
while (!(t % i)) {
p2[tot]++, t /= i;
}
}
}
if (t > 1) {
a[++tot] = t, p2[tot]++;
}
t = G;
for (int i = 1; i <= tot; i++) {
while (!(t % a[i])) {
p1[i]++, t /= a[i];
}
if (p1[i] > p2[i]) {
printf("0\n");
return 0;
}
}
if (t > 1) {
printf("0\n");
return 0;
}
for (int i = 1; i <= tot; i++) {
pw[i][0] = 1;
for (int j = 1; j <= p2[i]; j++) {
pw[i][j] = pw[i][j - 1] * a[i];
}
}
for (int s = 0; s < (1 << tot); s++) {
int x = 1, y = 1;
for (int i = 0; i < tot; i++) {
x *= ((s >> i) & 1) ? pw[i + 1][p2[i + 1]] : pw[i + 1][p1[i + 1]];
y *= ((s >> i) & 1) ? pw[i + 1][p1[i + 1]] : pw[i + 1][p2[i + 1]];
}
st.insert(pii(x, y));
}
printf("%lld\n", (int)st.size());
for (auto &p : st) {
printf("%lld %lld\n", p.first, p.second);
}
}
用户输出
2
1000 32000
32000 1000
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
0
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
0
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
0
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
1
24000 24000
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
8
283 834468949839
834468949839 283
849 278156316613
278156316613 849
1981 119209849977
119209
<49 bytes omitted>
用户输出
8
283 834468949839
849 278156316613
1981 119209849977
5943 39736616659
39736616659 5943
119209849977 1981
278156316613 849
83446
<12 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
32
44 454817853336
454817853336 44
88 227408926668
227408926668 88
132 151605951112
1516059511
<456 bytes omitted>
用户输出
32
44 454817853336
88 227408926668
132 151605951112
264 75802975556
308 64973979048
616 32486989524
924 21657993016
1364 1467154
<395 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
16
125 303851909375
303851909375 125
3125 12154076375
12154076375 3125
8375 4535103125
4535103
<186 bytes omitted>
用户输出
16
125 303851909375
3125 12154076375
8375 4535103125
42875 885865625
209375 181404125
528875 71815625
1071875 35434625
2872625 1
<141 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
128
457 368538658068
368538658068 457
1371 122846219356
122846219356 1371
1828 92134664517
921
<2243 bytes omitted>
用户输出
128
457 368538658068
1371 122846219356
1828 92134664517
3199 52648379724
5484 30711554839
9597 17549459908
10511 16023419916
127
<2086 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
16
447 762459896586
762459896586 447
894 381229948293
381229948293 894
19221 17731625502
17731
<196 bytes omitted>
用户输出
16
447 762459896586
894 381229948293
19221 17731625502
38442 8865812751
917691 371388162
1835382 185694081
4318467 78921426
8636
<151 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
64
1 953671355196
953671355196 1
3 317890451732
317890451732 3
4 238417838799
238417838799 4
<928 bytes omitted>
用户输出
64
1 953671355196
3 317890451732
4 238417838799
7 136238765028
12 79472612933
21 45412921676
28 34059691257
41 23260276956
84 11
<835 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
32
1 75953824090
75953824090 1
2 37976912045
37976912045 2
5 15190764818
15190764818 5
10 759
<378 bytes omitted>
用户输出
32
1 75953824090
2 37976912045
5 15190764818
10 7595382409
193 393543130
386 196771565
965 78708626
1930 39354313
1999 37995910
<317 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
8
2 959796438278
959796438278 2
118 16267736242
16267736242 118
55166 34796666
34796666 55166
<33 bytes omitted>
用户输出
8
2 959796438278
118 16267736242
55166 34796666
589774 3254794
3254794 589774
34796666 55166
16267736242 118
959796438278 2
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
8
1 612720601101
612720601101 1
7 87531514443
87531514443 7
9 68080066789
68080066789 9
63 97
<25 bytes omitted>
用户输出
8
1 612720601101
7 87531514443
9 68080066789
63 9725723827
9725723827 63
68080066789 9
87531514443 7
612720601101 1
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
64
1 571168626590
571168626590 1
2 285584313295
285584313295 2
5 114233725318
114233725318 5
<912 bytes omitted>
用户输出
64
1 571168626590
2 285584313295
5 114233725318
10 57116862659
47 12152523970
94 6076261985
139 4109126810
235 2430504794
278 20
<819 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
4
1 816033297854
2 408016648927
408016648927 2
816033297854 1
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
8
1 722299806965
722299806965 1
5 144459961393
144459961393 5
11 65663618815
65663618815 11
5
<31 bytes omitted>
用户输出
8
1 722299806965
5 144459961393
11 65663618815
55 13132723763
13132723763 55
65663618815 11
144459961393 5
722299806965 1
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
4
9 801129705372
36 200282426343
200282426343 36
801129705372 9
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
16
1 456969613602
456969613602 1
2 228484806801
228484806801 2
3 152323204534
152323204534 3
<156 bytes omitted>
用户输出
16
1 456969613602
2 228484806801
3 152323204534
6 76161602267
17 26880565506
34 13440282753
51 8960188502
102 4480094251
4480094
<111 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
2
1 624379090109
624379090109 1
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
1024
1 344111137370
344111137370 1
2 172055568685
172055568685 2
5 68822227474
68822227474 5
<15818 bytes omitted>
用户输出
1024
1 344111137370
2 172055568685
5 68822227474
7 49158733910
10 34411113737
11 31282830670
13 26470087490
14 24579366955
17 20
<14765 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
256
1 947358776276
947358776276 1
4 236839694069
236839694069 4
11 86123525116
86123525116 11
<3995 bytes omitted>
用户输出
256
1 947358776276
4 236839694069
11 86123525116
23 41189512012
44 21530881279
47 20156569708
53 17874693892
67 14139683228
71 1
<3710 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
512
1 740168683044
740168683044 1
3 246722894348
246722894348 3
4 185042170761
185042170761 4
<8027 bytes omitted>
用户输出
512
1 740168683044
3 246722894348
4 185042170761
7 105738383292
12 61680723587
19 38956246476
21 35246127764
28 26434595823
29 2
<7486 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
1024
1 844023861030
844023861030 1
2 422011930515
422011930515 2
3 281341287010
281341287010 3
<16214 bytes omitted>
用户输出
1024
1 844023861030
2 422011930515
3 281341287010
5 168804772206
6 140670643505
7 120574837290
10 84402386103
14 60287418645
15
<15161 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
1024
1 789491706234
789491706234 1
2 394745853117
394745853117 2
3 263163902078
263163902078 3
<16190 bytes omitted>
用户输出
1024
1 789491706234
2 394745853117
3 263163902078
6 131581951039
7 112784529462
11 71771973294
14 56392264731
17 46440688602
21
<15137 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
1024
1 776505385110
776505385110 1
2 388252692555
388252692555 2
3 258835128370
258835128370 3
<16176 bytes omitted>
用户输出
1024
1 776505385110
2 388252692555
3 258835128370
5 155301077022
6 129417564185
7 110929340730
10 77650538511
13 59731183470
14
<15123 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
1024
1 433304299740
433304299740 1
3 144434766580
144434766580 3
4 108326074935
108326074935 4
<15914 bytes omitted>
用户输出
1024
1 433304299740
3 144434766580
4 108326074935
5 86660859948
12 36108691645
13 33331099980
15 28886953316
17 25488488220
19 2
<14861 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
512
1 348510998660
348510998660 1
4 87127749665
87127749665 4
5 69702199732
69702199732 5
11
<7859 bytes omitted>
用户输出
512
1 348510998660
4 87127749665
5 69702199732
11 31682818060
17 20500646980
19 18342684140
20 17425549933
37 9419216180
41 8500
<7318 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
1024
1 642016938420
642016938420 1
4 160504234605
160504234605 4
5 128403387684
128403387684 5
<16086 bytes omitted>
用户输出
1024
1 642016938420
4 160504234605
5 128403387684
9 71335215380
11 58365176220
13 49385918340
17 37765702260
19 33790365180
20 3
<15033 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
2048
1 200560490130
200560490130 1
2 100280245065
100280245065 2
3 66853496710
66853496710 3
<31252 bytes omitted>
用户输出
2048
1 200560490130
2 100280245065
3 66853496710
5 40112098026
6 33426748355
7 28651498590
10 20056049013
11 18232771830
13 1542
<29175 bytes omitted>
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
2
341353499290 682706998580
682706998580 341353499290
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
1
545434896413 545434896413
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
2
404822138341 809644276682
809644276682 404822138341
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
1
277417427092 277417427092
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
2
347710816904 695421633808
695421633808 347710816904
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
2
28150115079 478551956343
478551956343 28150115079
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
2
99787625634 498938128170
498938128170 99787625634
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
4
16535387753 198424653036
198424653036 16535387753
49606163259 66141551012
66141551012 49606163
<5 bytes omitted>
用户输出
4
16535387753 198424653036
49606163259 66141551012
66141551012 49606163259
198424653036 16535387753
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
2
87178876849 784609891641
784609891641 87178876849
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
4
33540566239 402486794868
402486794868 33540566239
100621698717 134162264956
134162264956 10062
<9 bytes omitted>
用户输出
4
33540566239 402486794868
100621698717 134162264956
134162264956 100621698717
402486794868 33540566239
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
0
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
0
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
0
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
0
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
0
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
0
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
0
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
0
Special Judge 信息
Accepted!
系统信息
Exited with return code 0
用户输出
0
Special Judge 信息
Accepted!
系统信息
Exited with return code 0