QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#209079#4385. Randomucup-team1001WA 45ms3564kbC++14470b2023-10-10 09:26:282023-10-10 09:26:28

Judging History

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

  • [2023-10-10 09:26:28]
  • 评测
  • 测评结果:WA
  • 用时:45ms
  • 内存:3564kb
  • [2023-10-10 09:26:28]
  • 提交

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)<<std::endl;
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 45ms
memory: 3564kb

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
1719475899765
2539
1249
192
3227
4735
20464009257
2105796464763
8877886162299
1871209041573
108
8049343348479
9771
32442941505
1613661998241
327923270289
12518
3564231465957
2446
493631833053
6493080400593
3715
10673727755145
11704914172827
16284
3589
3853
13352017356927
4632352924737
10174
1...

result:

wrong answer 3rd lines differ - expected: '500001726', found: '1719475899765'