Bi-shoe and Phi-shoe
解题思路:
AC代码:
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
typedef long long ll;
int unprime[1000200];
void is_prime(){
memset(unprime,0,sizeof(unprime));
unprime[1] = 1;
for(int i = 2; i <= 1000100; i++){//注意临界值
int tt = 1000100/i;
for(int j = 2; j <= tt; j++){
unprime[i*j] = 1;
}
}
}
int main(){
is_prime();
int T,t = 1;
scanf("%d",&T);
while(T--){
int n,x;
scanf("%d",&n);
ll ans = 0;
for(int i = 0; i < n; i++){
scanf("%d",&x);
for(int j = x+1; ; j++){
if(!unprime[j]){
ans += j;
break;
}
}
}
printf("Case %d: %lld Xukha\n",t++,ans);
}
return 0;
}