QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#772733#9619. 乘积,欧拉函数,求和candy34#WA 0ms3684kbC++20978b2024-11-22 21:26:452024-11-22 21:26:45

Judging History

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

  • [2024-11-22 21:26:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3684kb
  • [2024-11-22 21:26:45]
  • 提交

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

Details

Tip: Click on the bar to expand more detailed information

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'