QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#739863 | #9619. 乘积,欧拉函数,求和 | Rosmontispes# | WA | 0ms | 3680kb | C++20 | 1.0kb | 2024-11-12 23:33:53 | 2024-11-12 23:34:03 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
const long long mod = 998244353;
const int N = 3000 + 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();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3680kb
input:
5 1 6 8 6 2
output:
180
result:
wrong answer 1st lines differ - expected: '892', found: '180'