标签:++ cin main net csdn ble space cstring pac
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
const int maxn=1e6+6;
int a[10004];
int n;
//欧拉函数表
int phi[maxn];
void phi_table(int n){
for(int i=2;i<=n;i++)
phi[i]=0;
phi[1]=1;
for(int i=2;i<=n;i++){
if(!phi[i]){
for(int j=i;j<=n;j+=i){
if(!phi[j])
phi[j]=j;
phi[j]=phi[j]/i*(i-1);
}
}
}
}
int main(){
phi_table(maxn);
int t;
cin>>t;
int k=0;
while(t--){
cin>>n;
int x;
long long ans=0;
for(int i=0;i<n;i++){
cin>>x;
for(int i=x+1;;i++){
if(phi[i]>=x){
ans+=i;
break;
}
}
}
cout<<"Case "<<++k<<": "<<ans<<" Xukha"<<endl;
}
return 0;
}
标签:++ cin main net csdn ble space cstring pac
原文地址:https://www.cnblogs.com/GarrettWale/p/11369988.html