Task: | Prsteni |
Sender: | untokarila |
Submission time: | 2019-07-25 14:14:43 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | ACCEPTED | 0.01 s | details |
#3 | ACCEPTED | 0.01 s | details |
#4 | ACCEPTED | 0.01 s | details |
#5 | ACCEPTED | 0.01 s | details |
#6 | ACCEPTED | 0.01 s | details |
#7 | ACCEPTED | 0.01 s | details |
#8 | ACCEPTED | 0.01 s | details |
#9 | ACCEPTED | 0.01 s | details |
#10 | ACCEPTED | 0.01 s | details |
Code
#include <bits/stdc++.h> using namespace std; int syt(int a, int b){ if(b==0) return a; return syt(b, a%b); } int main(){ int n, g[100], fa = 1, fb = 1; cin >> n >> g[0]; for(int i=1; i<n; i++){ cin >> g[i]; fa*=g[i-1]; fb*=g[i]; int m = syt(fa, fb); fa/=m; fb/=m; cout << fa << '/' << fb << '\n'; } return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
5
16 676 766 611 73 |
correct output |
---|
4/169
8/383 16/611 16/73 |
user output |
---|
4/169 8/383 16/611 16/73 |
Test 2
Verdict: ACCEPTED
input |
---|
10
23 296 9 679 726 419 378 676 2... |
correct output |
---|
23/296
23/9 23/679 23/726 23/419 ... |
user output |
---|
23/296 23/9 23/679 23/726 23/419 ... |
Test 3
Verdict: ACCEPTED
input |
---|
20
12 912 259 498 960 497 382 263... |
correct output |
---|
1/76
12/259 2/83 1/80 12/497 ... |
user output |
---|
1/76 12/259 2/83 1/80 12/497 ... Truncated |
Test 4
Verdict: ACCEPTED
input |
---|
30
6 534 572 31 722 253 955 35 47... |
correct output |
---|
1/89
3/286 6/31 3/361 6/253 ... |
user output |
---|
1/89 3/286 6/31 3/361 6/253 ... Truncated |
Test 5
Verdict: ACCEPTED
input |
---|
40
9 307 90 998 75 156 87 232 452... |
correct output |
---|
9/307
1/10 9/998 3/25 3/52 ... |
user output |
---|
9/307 1/10 9/998 3/25 3/52 ... Truncated |
Test 6
Verdict: ACCEPTED
input |
---|
50
24 203 511 839 646 384 284 552... |
correct output |
---|
24/203
24/511 24/839 12/323 1/16 ... |
user output |
---|
24/203 24/511 24/839 12/323 1/16 ... Truncated |
Test 7
Verdict: ACCEPTED
input |
---|
70
100 513 839 674 385 832 715 57... |
correct output |
---|
100/513
100/839 50/337 20/77 25/208 ... |
user output |
---|
100/513 100/839 50/337 20/77 25/208 ... Truncated |
Test 8
Verdict: ACCEPTED
input |
---|
90
81 12 557 79 821 766 911 734 7... |
correct output |
---|
27/4
81/557 81/79 81/821 81/766 ... |
user output |
---|
27/4 81/557 81/79 81/821 81/766 ... Truncated |
Test 9
Verdict: ACCEPTED
input |
---|
100
50 241 302 480 885 857 624 906... |
correct output |
---|
50/241
25/151 5/48 10/177 50/857 ... |
user output |
---|
50/241 25/151 5/48 10/177 50/857 ... Truncated |
Test 10
Verdict: ACCEPTED
input |
---|
100
40 241 302 480 885 857 624 906... |
correct output |
---|
40/241
20/151 1/12 8/177 40/857 ... |
user output |
---|
40/241 20/151 1/12 8/177 40/857 ... Truncated |