QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#589013#9376. GameTrspntWA 0ms3592kbC++231.0kb2024-09-25 15:40:472024-09-25 15:40:47

Judging History

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

  • [2024-09-25 15:40:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3592kb
  • [2024-09-25 15:40:47]
  • 提交

answer

#include <bits/stdc++.h>

#define int long long

using namespace std;
typedef pair<int,int> PII;
typedef tuple<int,int,int> tp;
const int N = 110,INF = 0x3f3f3f3f3f3f3f3f,mod = 998244353;

int sub_gcd(int a,int b,int cnt)
{
    if(a>=b)return cnt;
    return sub_gcd(2*a%mod,(b-a+mod)%mod,cnt+1);
}

int qmi(int a,int b,int p)
{
    int res=1;
    while(b)
    {
        if(b&1)res=res*a%p;
        a=a*a%p;
        b>>=1;
    }
    return res;
}

void solve()
{
    int x,y;
    cin>>x>>y;
    int a0,a1,c;
    cin>>a0>>a1>>c;
    int res=qmi((a0+a1)%mod,mod-2,mod);
    int a=a0*res%mod;
    int b=a1*res%mod;
    int n=sub_gcd(x,y,0);
    cout<<a*qmi(a,n,mod)%mod<<"\n";
//    int down=(mod+1-a)%mod;
//    down=qmi(down,mod-2,mod);
//    int up=(mod+1-qmi(a,n,mod))%mod;
//    up=up*a%mod;
//    cout<<up*down%mod<<"\n";
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T=1;
    cin>>T;
    //init();
    while(T--)solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3592kb

input:

3
1 1
2 2 6
1 3
2 3 6
3 4
7 3 15

output:

499122177
279508419
668823717

result:

wrong answer 2nd lines differ - expected: '910398850', found: '279508419'