QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#739830#9619. 乘积,欧拉函数,求和Rosmontispes#WA 0ms3700kbC++201.3kb2024-11-12 23:21:292024-11-12 23:21:30

Judging History

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

  • [2024-11-12 23:21:30]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3700kb
  • [2024-11-12 23:21:29]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
const long long mod = 998244353;
const int N = 3000 + 20;
long long phi[N],prime[N];
bool is_prime[N];
void phi_table() 
{
    int n = 3000;
    memset(is_prime, 1, sizeof(is_prime));
    int cnt = 0;
    is_prime[1] = 0;
    phi[1] = 1;
    for (int i = 2; i <= n; i++) 
    {
        if (is_prime[i]) 
        {
            prime[++cnt] = i;
            phi[i] = i - 1;
        }
        for (int j = 1; j <= cnt && i * prime[j] <= n; j++) 
        {
            is_prime[i * prime[j]] = 0;
            if (i % prime[j])
                phi[i * prime[j]] = phi[i] * phi[prime[j]];
            else 
            {
                phi[i * prime[j]] = phi[i] * prime[j];
                break;
            }
        }
    }
}
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);
    phi_table();
    solve();
}
// 4
// 4
// #..#
// .##.
// 5
// ##.#.
// .#.##
// 6
// ######
// .####.
// 27
// .######.######.####.#.#####
// .####...####..#.......#####

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3700kb

input:

5
1 6 8 6 2

output:

180

result:

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