QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#196266#6957. Do You Like Interactive Problems?yiyiyi#WA 0ms3616kbC++14727b2023-10-01 14:55:172023-10-01 14:55:17

Judging History

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

  • [2023-10-01 14:55:17]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3616kb
  • [2023-10-01 14:55:17]
  • 提交

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*n%mo*ksm(3%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: 0ms
memory: 3616kb

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:

668226464
710538915
101877134
981130112
667837087
434274842
9
905092286
830644699
653571902
2340849
374338972
332748128
667837091
275611923
217088757
724601096
858757821
335088968
0
98514910
516142977
332748124
286155397
341574723
267054559
665907229
202233085
335088976
727616847
336063252
237006032...

result:

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