QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#618781 | #1881. Roads of the Empire | ydzr00000 | WA | 0ms | 3796kb | C++17 | 451b | 2024-10-07 10:13:25 | 2024-10-07 10:13:26 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
inline void solve()
{
long long n,u,v;
scanf("%lld %lld %lld",&n,&u,&v);
long long now=v,step=0;
while(now!=u)
{
if(n%now==0)
{
puts("-1");
return;
}
now-=n%now;
step++;
}
printf("%lld\n",step);
}
int main(){
int t;
scanf("%d",&t);
while(t--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3796kb
input:
4 5 1 2 8 2 5 7 7 2 6 2 5
output:
1 1 -1 2
result:
ok 4 number(s): "1 1 -1 2"
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3712kb
input:
1 88 14 2
output:
-1
result:
wrong answer 1st numbers differ - expected: '2', found: '-1'