QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#681054 | #9435. Welcome to NPCAPC | Maybe_Tomorrow | WA | 1ms | 3580kb | C++14 | 856b | 2024-10-27 00:30:00 | 2024-10-27 00:30:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
typedef long long lol;
lol binpow (lol x, int e) {
lol ans = 1, exp = x;
for (int i = e; i > 0; i >>= 1) {
if (i&1) ans = (ans * exp) % MOD;
exp = (exp * exp) % MOD;
}
return ans;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t; cin >> t;
lol inv720 = binpow(720, MOD-2);
while (t--) {
int n; cin >> n;
if (n<12) {
cout << "0\n";
continue;
}
// n choose 6
lol nC6 = inv720;
for (int i = 0; i < 6; i++) nC6 = (nC6 * (n-i)) % MOD;
// (n-6) choose 6
lol minnC6 = inv720;
for (int i = 6; i < 12; i++) minnC6 = (minnC6 * (n-i)) % MOD;
// 52^(n-12)
lol oth = binpow(52, n-12);
lol res = (((nC6 * minnC6) % MOD) * oth) % MOD;
cout << res%MOD << "\n";
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3580kb
input:
4 12 6 5839 123456
output:
924 0 930215398 43950130
result:
wrong answer 3rd numbers differ - expected: '966252995', found: '930215398'