QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#618781#1881. Roads of the Empireydzr00000WA 0ms3796kbC++17451b2024-10-07 10:13:252024-10-07 10:13:26

Judging History

你现在查看的是最新测评结果

  • [2024-10-07 10:13:26]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3796kb
  • [2024-10-07 10:13:25]
  • 提交

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'