Task: | kusac |
Sender: | Kuha |
Submission time: | 2016-07-27 14:39:35 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
test | verdict | time | |
---|---|---|---|
#1 | RUNTIME ERROR | 0.13 s | details |
#2 | RUNTIME ERROR | 0.14 s | details |
#3 | ACCEPTED | 0.05 s | details |
#4 | ACCEPTED | 0.05 s | details |
#5 | ACCEPTED | 0.05 s | details |
#6 | RUNTIME ERROR | 0.14 s | details |
#7 | RUNTIME ERROR | 0.14 s | details |
#8 | WRONG ANSWER | 0.05 s | details |
#9 | RUNTIME ERROR | 0.14 s | details |
#10 | WRONG ANSWER | 0.06 s | details |
#11 | RUNTIME ERROR | 0.14 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:19:9: warning: unused variable 'g' [-Wunused-variable] int g = gcd(n, m % n); ^ input/code.cpp:26:9: warning: unused variable 'g' [-Wunused-variable] int g = gcd(n, m % n); ^
Code
#include <bits/stdc++.h> #define ll long long #define INF 999999999 #define N (1<<17) #define M 1000000007 using namespace std; int gcd(int a, int b) { if (!b) return a; return gcd(b, a % b); } int main () { int n, m; cin>>n>>m; if (n == m) cout<<0<<endl; else if (n < m) { int g = gcd(n, m % n); int ans = n * (m / n); ans += (m % n) / (n % (m % n)) - 1; cout<<ans<<endl; } else { n = n % m; if (!n) cout<<0<<endl, exit(0); int g = gcd(n, m % n); int ans = n * (m / n); ans += (m % n) / (n % (m % n)) - 1; cout<<ans<<endl; } }
Test details
Test 1
Verdict: RUNTIME ERROR
input |
---|
2 6 |
correct output |
---|
4 |
user output |
---|
(empty) |
Test 2
Verdict: RUNTIME ERROR
input |
---|
3 4 |
correct output |
---|
3 |
user output |
---|
(empty) |
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: RUNTIME ERROR
input |
---|
15 16 |
correct output |
---|
15 |
user output |
---|
(empty) |
Test 7
Verdict: RUNTIME ERROR
input |
---|
10 90 |
correct output |
---|
80 |
user output |
---|
(empty) |
Test 8
Verdict: WRONG ANSWER
input |
---|
79 56 |
correct output |
---|
55 |
user output |
---|
48 |
Test 9
Verdict: RUNTIME ERROR
input |
---|
39 26 |
correct output |
---|
13 |
user output |
---|
(empty) |
Test 10
Verdict: WRONG ANSWER
input |
---|
56 98 |
correct output |
---|
84 |
user output |
---|
58 |
Test 11
Verdict: RUNTIME ERROR
input |
---|
90 54 |
correct output |
---|
36 |
user output |
---|
(empty) |