QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#739880#9619. 乘积,欧拉函数,求和Rosmontispes#WA 1ms4612kbC++201.0kb2024-11-12 23:40:322024-11-12 23:40:34

Judging History

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

  • [2024-11-12 23:40:34]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4612kb
  • [2024-11-12 23:40:32]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const long long mod = 998244353;
const int N = 100000 + 20;
bool isprime[N + 1];
int phi[N + 1];
std::vector<int> primes;
void init(){
    std::fill(isprime + 2, isprime + N + 1, true);
    phi[1] = 1;
    for (int i = 2; i <= N; i++) {
        if (isprime[i]) {
            primes.push_back(i);
            phi[i] = i - 1;
        }
        for (auto p : primes) {
            if (i * p > N) {
                break;
            }
            isprime[i * p] = false;
            if (i % p == 0) {
                phi[i * p] = phi[i] * p;
                break;
            }
            phi[i * p] = phi[i] * (p - 1);
        }
    }
        
}

void solve()
{
    int n;
    cin>>n;
    long long ans = 1;
    for(int i = 1;i <= n;i ++){
        long long x;
        cin>>x;
        ans = ans * (1 + phi[x]) % mod;
    }
    cout<<ans<<"\n";
}

signed main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    init();
    solve();
}

详细

Test #1:

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

input:

5
1 6 8 6 2

output:

180

result:

wrong answer 1st lines differ - expected: '892', found: '180'