用户输出
5
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#20738 | #1069. jwp来发糖果了 | Accepted | 100 | 44 ms | 372 K | C++ 11 / 740 B | JM233333 | 2019-08-01 18:57:44 |
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b);
ll lcm(ll a, ll b);
const int MAX = 15;
ll A[MAX];
int main() {
// freopen("test.txt", "r", stdin);
int T;
int k;
ll a;
scanf("%d", &T);
while (T--) {
// 输入
scanf("%d %lld", &k, &a);
for (int i = 1; i <= k; i++) {
scanf("%lld", &A[i]);
}
// 求解
ll res = 1;
for (int i = 1; i <= k; i++) {
res = lcm(res, A[i]);
}
res -= a;
// 输出
printf("%lld\n", res);
}
return 0;
}
// 最大公约数
ll gcd(ll a, ll b) { return (b == 0 ? a : gcd(b, a % b)); }
// 最小公倍数
inline ll lcm(ll a, ll b) { return (a / gcd(a, b) * b); }
393
6 16
61 95 34 89 74 27
2 18
75 78
8 21
70 78 41 71 79 66 95 45
7 15
81 96 24 29 96 93
<10215 bytes omitted>
17518134314
1932
393640236969
11651025
145345886396
108226918783
366581804
13595541948
26657
<3862 bytes omitted>
用户输出
17518134314
1932
393640236969
11651025
145345886396
108226918783
366581804
13595541948
266574913005
133847
4098175179
8200571266
<3441 bytes omitted>
系统信息
Exited with return code 0
142
10 8
13 26 13 57 53 10 87 50 14 96
2 10
99 62
7 18
72 70 99 24 65 70 99
5 10
11 39 58
<3571 bytes omitted>
6377935192
6128
360342
7564118
44
28513036
44344864
1304579235953
36953
1671595364
97668
<1304 bytes omitted>
用户输出
6377935192
6128
360342
7564118
44
28513036
44344864
1304579235953
36953
1671595364
97668
1081
896
214996
1136885047
7124826701
2
<1134 bytes omitted>
系统信息
Exited with return code 0
161
9 3
55 41 11 66 17 26 47 91 17
8 20
92 38 34 23 67 59 96 30
8 13
55 97 15 72 36 91 82 97
<4016 bytes omitted>
983752767
14096081740
1433151707
346520914731
2447471786
77183708538
4090335464
27119
763343
<1497 bytes omitted>
用户输出
983752767
14096081740
1433151707
346520914731
2447471786
77183708538
4090335464
27119
7633431
86653967394
10196656456
2801384
11
<1308 bytes omitted>
系统信息
Exited with return code 0
187
6 6
13 93 43 19 61 57
6 10
72 97 92 45 56 29
7 20
99 47 98 37 56 96 61
3 6
23 49 74
<4545 bytes omitted>
60252927
163041470
16466855308
83392
76576482672
205164954
5596356
462575503
5435353544
771
<1688 bytes omitted>
用户输出
60252927
163041470
16466855308
83392
76576482672
205164954
5596356
462575503
5435353544
77115484660
9477343255
20154
6555254
701
<1473 bytes omitted>
系统信息
Exited with return code 0
109
4 8
42 35 47 62
10 7
13 81 81 57 37 73 43 34 58 60
5 21
43 56 25 73 99
5 5
100 17 61
<2802 bytes omitted>
305962
22911415789853
435065379
63153295
529926
1590749146
5347314561109
508151152061
1667
<998 bytes omitted>
用户输出
305962
22911415789853
435065379
63153295
529926
1590749146
5347314561109
508151152061
1667
1243398576402
923143953
2766
23279252
<861 bytes omitted>
系统信息
Exited with return code 0
233
3 12
13 60 74
10 7
61 20 95 82 87 83 95 12 96 53
10 4
84 97 50 47 54 92 80 24 86 36
8
<5894 bytes omitted>
28848
2909782247513
340869135596
1473945896
4434003301960
7891410
1691
96945021
35677712569
<2217 bytes omitted>
用户输出
28848
2909782247513
340869135596
1473945896
4434003301960
7891410
1691
96945021
35677712569
972
147879
12659825875
1088092636
68
<1956 bytes omitted>
系统信息
Exited with return code 0
253
10 6
55 75 74 98 22 35 56 9 62 62
4 5
78 50 67 31
10 21
86 55 72 48 45 74 75 40 93 67
<6516 bytes omitted>
1112819394
4050145
130858477179
6390829
10764
637541
721163329
25410378823
22062285610
1664
<2442 bytes omitted>
用户输出
1112819394
4050145
130858477179
6390829
10764
637541
721163329
25410378823
22062285610
1664031596
76
234915599085
38206726
83319
<2161 bytes omitted>
系统信息
Exited with return code 0
305
5 21
69 80 38 96 90
2 3
72 94
7 15
85 57 89 39 30 60 57
7 8
91 31 53 40 76 55 47
10
<7689 bytes omitted>
629259
3381
22422645
58746647952
338098343307
65
48504317394
15612888051
428621525
1183
34
<2889 bytes omitted>
用户输出
629259
3381
22422645
58746647952
338098343307
65
48504317394
15612888051
428621525
1183
344701944830
958137177
9647808
1352
4950
<2556 bytes omitted>
系统信息
Exited with return code 0
331
3 4
26 33 70
10 17
29 22 30 78 93 53 84 43 80 61
4 3
78 72 87 72
9 17
28 62 26 79 96
<8220 bytes omitted>
30026
30024734179423
27141
10376315023
259751206
217936909
8917501563
7636853
1078
10325
4
<3075 bytes omitted>
用户输出
30026
30024734179423
27141
10376315023
259751206
217936909
8917501563
7636853
1078
10325
4438
263663
1920
1531516
108356
136779
<2716 bytes omitted>
系统信息
Exited with return code 0
360
9 16
89 69 50 43 38 77 31 46 33
5 5
11 60 28 11 60
5 18
39 37 55 54 96
3 10
75 96 84
<9227 bytes omitted>
598802461934
4615
22857102
16790
28641580
3408627
3621579356
1306
907
327166
197789309
48
<3456 bytes omitted>
用户输出
598802461934
4615
22857102
16790
28641580
3408627
3621579356
1306
907
327166
197789309
48752083
121256
46433431188
4467457803893
<3068 bytes omitted>
系统信息
Exited with return code 0