QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#196258#6957. Do You Like Interactive Problems?yiyiyi#WA 1ms3572kbC++14723b2023-10-01 14:52:082023-10-01 14:52:09

Judging History

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

  • [2023-10-01 14:52:09]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3572kb
  • [2023-10-01 14:52:08]
  • 提交

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+4*(n-2)%mo*ksm(3*n%mo,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: 3572kb

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:

669862211
543921014
351449626
748089884
674779716
491476272
873463810
855295537
235982258
644278867
293475315
430023636
53404020
792927171
303995932
312777003
128036795
925292345
5573454
0
646638012
372190299
924300328
910284689
269675858
101070164
924138109
33902740
499463039
217826471
811964235
76...

result:

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