QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#751358 | #9619. 乘积,欧拉函数,求和 | walili# | WA | 0ms | 3616kb | C++20 | 1.0kb | 2024-11-15 18:17:15 | 2024-11-15 18:17:16 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define endl '\n'
const ll inf = 1e17;
const ll mod = 998244353;
ll phi(ll x) {
ll result = 0;
for (ll i = 1; i <= x; ++i)
if (gcd(x, i) == 1)
++result;
return result;
}
void oper(ll testcase) {
ll n = 0;
cin >> n;
vector<ll> a(n);
for (ll i = 0; i < n; ++i)
cin >> a[i];
vector<ll> phi_a(n);
for (ll i = 0; i < n; ++i)
phi_a[i] = phi(a[i]);
vector<vector<ll>> results(n + 1, vector<ll>(n + 1));
for (ll j = 0; j <= n; ++j)
results[0][j] = 1;
for (ll i = 1; i <= n; ++i)
for (ll j = 1; j <= n; ++j)
results[i][j] = (results[i - 1][j] + results[i - 1][j - 1] * phi_a[i - 1]) % mod;
cout << results[n][n] << '\n';
}
int main() {
ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
cout<<fixed<<setprecision(2);
ll ttt = 1;
// cin >> ttt;
for (ll i = 1; i <= ttt; i++) {
oper(i);
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3616kb
input:
5 1 6 8 6 2
output:
180
result:
wrong answer 1st lines differ - expected: '892', found: '180'