QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#209081 | #4385. Random | ucup-team1001 | WA | 52ms | 3388kb | C++14 | 476b | 2023-10-10 09:27:14 | 2023-10-10 09:27:14 |
Judging History
answer
#include<bits/stdc++.h>
const int maxn=2e5+5;
const int mod=998244353;
long long pows(long long x,long long k)
{
long long cnt=1;
while(k){
if(k&1){
cnt*=x;
cnt%=mod;
}
k>>=1;
x*=x;
x%=mod;
}
return cnt;
}
int main()
{
int t;
std::cin>>t;
while(t--){
long long n,m;
std::cin>>n>>m;
if((n-m)%2==0){
std::cout<<(n-m)/2<<std::endl;
}
else{
std::cout<<((n-m)*pows(2,mod-2))%mod<<std::endl;
}
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 52ms
memory: 3388kb
input:
100000 42 30 6335 1161 19170 15725 11479 6401 26963 24465 5706 5322 23282 16828 9962 492 2996 2955 4828 609 32392 14605 3903 154 293 77 17422 1295 19719 177 5448 5383 14772 11539 1870 1213 25668 632 17036 9895 28704 23812 31323 30334 17674 4665 15142 7712 28254 6869 25548 2097 32663 95 20038 12860 8...
output:
6 2587 499123899 2539 1249 192 3227 4735 499122197 499124286 499131070 499124051 108 499130240 9771 499122209 499123793 499122505 12518 499125747 2446 499122671 499128681 3715 499132869 499133902 16284 3589 3853 499135552 499126817 10174 119 49 499130117 499123997 499126757 4510 499129136 499132599 ...
result:
wrong answer 3rd lines differ - expected: '500001726', found: '499123899'