QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#761347#9627. 算术xdz_#WA 1ms3560kbC++201005b2024-11-18 22:17:252024-11-18 22:17:28

Judging History

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

  • [2024-11-18 22:17:28]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3560kb
  • [2024-11-18 22:17:25]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define fi first
#define se second
#define endl '\n'

typedef pair<int,int> PII;

const int N = 1e5 + 10,mod = 998244353;
vector<int> edge[N];
int qmi(int a,int b){
	int res = 1;
	while(b){
		if(b & 1)res = res * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return res;
}
void solve(){
	vector<int> a(10);
	for(int i = 1;i <= 9;i ++) cin>>a[i];
	if(a[1] >= a[2]){
		a[1] -= a[2];
		a[3] += a[2];
		a[2] = 0;
		if(a[1] > 0){
			int k = a[1] / 3;
			a[1] -= k * 3;
			a[3] += k;
		}
		if(a[1] == 2){
			a[2] ++;
		}
		if(a[1] == 1){
			if(a[3] > 0){
				a[3] --;
				a[4] ++;
			}
		}
	}
	else{
		a[3] += a[1];
		a[2] -= a[1];
		a[1] = 0;
	}
	int ans = 1;
	for(int i = 2;i <= 9;i ++){
		ans = ans * qmi(i,a[i]);
		ans %= mod;
	}
	cout<<ans<<endl;
}

signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int T;
	T = 1;
	cin>>T;
	while(T --){
		solve();
	}
}

詳細信息

Test #1:

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

input:

7
5 3 0 0 0 0 0 0 0
4 1 1 1 0 0 0 0 0
1 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 2
99 88 77 66 55 44 33 22 11
100 90 80 70 60 50 40 30 20

output:

54
108
1
9
81
90553232
143532368

result:

wrong answer 4th lines differ - expected: '10', found: '9'