QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#196291#6957. Do You Like Interactive Problems?yiyiyi#WA 1ms3560kbC++14724b2023-10-01 15:18:422023-10-01 15:18:43

Judging History

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

  • [2023-10-01 15:18:43]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3560kb
  • [2023-10-01 15:18:42]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define inf 0x3f3f3f3f
#define re register
#define N 1020030
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
const int mo=998244353;
inline int read(){
	int x=0,w=0;char ch=getchar();
	while (!isdigit(ch))w|=ch=='-',ch=getchar();
	while (isdigit(ch))x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
	return w?-x:x;
}
int ksm(int x,int p){
	int res=1;
	for (;p;p>>=1){
		if (p&1)res=res*x%mo;
		x=x*x%mo;
	}
	return res;
}
void solve(){
	int n=read(); 
	if (n==1){puts("0");return;}
	cout<<(n+(n-2)*3%mo*n%mo*ksm(2,mo-2)%mo)*ksm(n,mo-2)%mo<<endl;
}
signed main(){
    int T=read();
    while (T--)solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3560kb

input:

100
251608761
33782011
325968940
486286497
999999993
575267221
8
928380304
123861349
739740016
999999991
31193142
9
999999996
705831120
162816569
293889735
644068367
999999992
1
323447272
387107234
6
214616549
755303220
699413097
499430423
151674815
999999998
46590460
2486352
926437790
248790470
100...

output:

876535316
549795191
488953408
230307567
2633458
363778653
10
394326101
684914198
111365669
2633455
46789711
499122188
501755639
60502325
743347028
939956777
466980372
501755633
0
485170906
580660849
7
821046998
134710475
549997467
250023456
726634397
501755642
69885688
3729526
391412330
373185703
50...

result:

wrong answer 1st lines differ - expected: '833235409', found: '876535316'