QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#747820#9627. 算术Lazy_boy#WA 0ms3552kbC++201.1kb2024-11-14 18:22:302024-11-14 18:22:31

Judging History

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

  • [2024-11-14 18:22:31]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3552kb
  • [2024-11-14 18:22:30]
  • 提交

answer

#include<bits/stdc++.h>

#define int long long
#define endl '\n'
#define pii std::pair<int ,int>
#define fix(x) std::fixed << std::setprecision(x)
const int inf = 1e17 + 50, MAX_N = 1e5 + 50, mod = 998244353;

void solve() {
	std::vector<int> a(11, 0);
	for(int i = 0; i < 9; i++) {
		std::cin >> a[i + 1];
	}

	int mi = std::min(a[1], a[2]);
	a[1] -= mi, a[2] -= mi, a[3] += mi;
	a[3] += a[1] / 3, a[1] %= 3;
	if (a[1] == 2) {
		a[2]++;
	} else if (a[1] == 1) {
		for(int i = 2; i <= 9; i++) {
			if (a[i]) {
				a[i]--;
				a[i + 1]++;
				break;
			}
		}
	}

	int res = 1;
	for(int i = 2; i <= 9; i++) {
		while (a[i]--) {
			res = res * i % mod;
		}
	}

	std::cout << res << endl;
}

signed main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr), std::cout.tie(nullptr);
	int Lazy_boy_ = 1;
	std::cin >> Lazy_boy_;
	while (Lazy_boy_--) solve();
	return 0;
}
/*
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
 */

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3552kb

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
1
9
90553232
143532368

result:

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