Task: | kusac |
Sender: | Hansuzu |
Submission time: | 2016-07-27 14:12:58 +0300 |
Language: | C++ |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.06 s | details |
#2 | ACCEPTED | 0.05 s | details |
#3 | ACCEPTED | 0.05 s | details |
#4 | ACCEPTED | 0.05 s | details |
#5 | ACCEPTED | 0.06 s | details |
#6 | ACCEPTED | 0.05 s | details |
#7 | ACCEPTED | 0.05 s | details |
#8 | ACCEPTED | 0.06 s | details |
#9 | ACCEPTED | 0.05 s | details |
#10 | ACCEPTED | 0.06 s | details |
#11 | ACCEPTED | 0.05 s | details |
Code
#include <iostream> using namespace std; int N, M; int gcd(int a, int b){return b==0?a:gcd(b, a%b);} int main(){ cin >> N >> M; int g=gcd(N, M); M/=g; cout << g*(M-1) << "\n"; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
2 6 |
correct output |
---|
4 |
user output |
---|
4 |
Test 2
Verdict: ACCEPTED
input |
---|
3 4 |
correct output |
---|
3 |
user output |
---|
3 |
Test 3
Verdict: ACCEPTED
input |
---|
6 2 |
correct output |
---|
0 |
user output |
---|
0 |
Test 4
Verdict: ACCEPTED
input |
---|
7 7 |
correct output |
---|
0 |
user output |
---|
0 |
Test 5
Verdict: ACCEPTED
input |
---|
15 5 |
correct output |
---|
0 |
user output |
---|
0 |
Test 6
Verdict: ACCEPTED
input |
---|
15 16 |
correct output |
---|
15 |
user output |
---|
15 |
Test 7
Verdict: ACCEPTED
input |
---|
10 90 |
correct output |
---|
80 |
user output |
---|
80 |
Test 8
Verdict: ACCEPTED
input |
---|
79 56 |
correct output |
---|
55 |
user output |
---|
55 |
Test 9
Verdict: ACCEPTED
input |
---|
39 26 |
correct output |
---|
13 |
user output |
---|
13 |
Test 10
Verdict: ACCEPTED
input |
---|
56 98 |
correct output |
---|
84 |
user output |
---|
84 |
Test 11
Verdict: ACCEPTED
input |
---|
90 54 |
correct output |
---|
36 |
user output |
---|
36 |