QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#803834#8962. Immensely Long Expressionspanhuachao#WA 0ms3816kbC++20936b2024-12-07 18:57:362024-12-07 18:57:43

Judging History

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

  • [2024-12-07 18:57:43]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3816kb
  • [2024-12-07 18:57:36]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
using namespace std;

const ll p = 998244353;
ll quickpow(ll base, ll index){
    base %= p;
    index %= p-1;
    ll res = 1;
    while(index > 0){
        if(index & 1) res = res * base % p;
        base = base * base % p; index >>= 1;
    }
    return res;
}
ll inv(ll v){ v = (v%p+p)%p; return quickpow(v, p-2); }
const ll inv2 = inv(2);
const ll q = inv(19) * ((0+1+2+3+4+5+6+7+8+9+inv(1)+inv(2)+inv(3)+inv(4)+inv(5)+inv(6)+inv(7)+inv(8)+inv(9))%p) % p;
const ll g0 = inv(10) * (0+1+2+3+4+5+6+7+8+9) % p;
ll n;
void solve(){
    scanf("%lld", &n);
    ll k = n/2;
    ll ans = g0 * (inv2 * (1-quickpow(inv2*q,k)) % p * inv(1-inv2*q) % p + quickpow(inv2*q, k)) % p;
    printf("%lld\n", (ans%p+p)%p);
}

int main(){
    // printf("%lld\n", (inv2 * g0 % p + inv2 * g0 % p * q % p) % p); 
    int t; scanf("%d", &t);
    while(t--) solve();
    return 0;
}

詳細信息

Test #1:

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

input:

7
1
3
5
7
9
998244353
111111111224317155

output:

499122181
390619403
593408828
798770225
581676430
418437218
455967110

result:

wrong answer 2nd numbers differ - expected: '137441435', found: '390619403'