CSES - COCI 2006/2007 #4 - Results
Submission details
Task:Prsteni
Sender:henrikaalto
Submission time:2019-07-25 13:53:57 +0300
Language:C++ (C++17)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#2ACCEPTED0.01 sdetails
#3ACCEPTED0.01 sdetails
#4ACCEPTED0.01 sdetails
#5ACCEPTED0.01 sdetails
#6ACCEPTED0.01 sdetails
#7ACCEPTED0.01 sdetails
#8ACCEPTED0.01 sdetails
#9ACCEPTED0.01 sdetails
#10ACCEPTED0.01 sdetails

Code

#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define F first
#define S second
using pi=pair<int,int>;
using ii=long long;
int main()
{
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    ii a = 1, b = 1;
    for (int i = 1; i < n; ++i) {
        a *= v[i - 1];
        b *= v[i];
        ii u = __gcd(a, b);
        a /= u; b /= u;
        cout << a << "/"<<b<<"\n";
    }
}

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