QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#209081#4385. Randomucup-team1001WA 52ms3388kbC++14476b2023-10-10 09:27:142023-10-10 09:27:14

Judging History

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

  • [2023-10-10 09:27:14]
  • 评测
  • 测评结果:WA
  • 用时:52ms
  • 内存:3388kb
  • [2023-10-10 09:27:14]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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'