QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#751358#9619. 乘积,欧拉函数,求和walili#WA 0ms3616kbC++201.0kb2024-11-15 18:17:152024-11-15 18:17:16

Judging History

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

  • [2024-11-15 18:17:16]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3616kb
  • [2024-11-15 18:17:15]
  • 提交

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);
    }
}

Details

Tip: Click on the bar to expand more detailed information

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'