CSES - Datatähti 2022 loppu - Results
Submission details
Task:Pallo
Sender:EeliH
Submission time:2022-01-22 16:42:26 +0200
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.01 s1, 2, 3details
#20.01 s2, 3details
#3--3details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:15:18: warning: unused variable 'kerroin' [-Wunused-variable]
         __int128 kerroin;
                  ^~~~~~~

Code

#include <bits/stdc++.h>

using namespace std;

int main()
{
    uint64_t t;
    cin >> t;

    for(uint64_t q = 0; q < t; q++) {
        uint64_t n, m, k;
        cin >> n >> m >> k;

        uint64_t maara;
        __int128 kerroin;
        uint64_t s = max(n-1, m-1);
        uint64_t p = min(n-1, m-1);
    
        uint64_t j = p;
        uint64_t j1 = s;
        while(j1 % j != 0) {
            if(j > j1) {
                j1 += s;
            } else {
                j += p;
            }
        }

        maara = (uint64_t) (k / (n - 1)) + (uint64_t) (k / (m - 1)) - (uint64_t) (k / (j));
        cout << maara << endl;
    }
}

Test details

Test 1

Group: 1, 2, 3

Verdict:

input
100
10 5 76
9 8 78
8 6 49
3 3 94
...

correct output
25
19
15
47
8
...

user output
25
19
15
47
4
...
Truncated

Test 2

Group: 2, 3

Verdict:

input
1000
7 5 99033171167123849
6 8 472883555390027162
9 10 258937093512465880
10 6 691774305483997493
...

correct output
33011057055707949
148620545979722822
57541576336103529
199845910473154830
52151060432923288
...

user output
33011057055707949
148620545979722822
57541576336103529
199845910473154830
5215106043292328
...
Truncated

Test 3

Group: 3

Verdict:

input
1000
816332614 86098803 33572721929...

correct output
4310587870
45982113074
1550250683
717639357
3282221941
...

user output
(empty)