QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#772733 | #9619. 乘积,欧拉函数,求和 | candy34# | WA | 0ms | 3684kb | C++20 | 978b | 2024-11-22 21:26:45 | 2024-11-22 21:26:45 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define ph push_back
#define pp pop_back
using namespace std;
const int N=2e3+5,M=3e3+5,mod=998244353;
int n,a[N];
bool pd[M];
int cnt,phi[M],prime[M];
void getphi(int n)
{
pd[0]=pd[1]=1;
phi[1]=1;
for(int i=2;i<=n;i++)
{
if(!pd[i])
{
prime[++cnt]=i;
phi[i]=i-1;
}
for(int j=1;j<=cnt&&i*prime[j]<=n;j++)
{
pd[i*prime[j]]=1;
if(i%prime[j]==0)
{
phi[i*prime[j]]=phi[i]*prime[j];
break;
}
phi[i*prime[j]]=phi[i]*phi[prime[j]];
}
}
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
cin>>n;
for(int i=1;i<=n;i++) cin>>a[i];
getphi(M-2);
int ans=1;
for(int i=1;i<=n;i++) ans=ans*(phi[a[i]]+1ll)%mod;
cout<<ans<<endl;
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3684kb
input:
5 1 6 8 6 2
output:
180
result:
wrong answer 1st lines differ - expected: '892', found: '180'