QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#739830 | #9619. 乘积,欧拉函数,求和 | Rosmontispes# | WA | 0ms | 3700kb | C++20 | 1.3kb | 2024-11-12 23:21:29 | 2024-11-12 23:21:30 |
Judging History
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'