Test instructions: Given the value of the Euler function of a number, you ask for the smallest number that satisfies the value of the Euclidean function, and then sum it.
Idea: Manual simulation of Sample 2, found that the number of conditions satisfies the next occurrence of a given number of prime numbers.
For example 10, the next prime number is 11;11, the next prime number is 13, 12, the next is 13, 13, the next is 17, and so on.
#include <cmath>#include<cstdio>#include<cstring>#include<iostream>#include<algorithm>using namespacestd;Const intMAXN = 1e6+Ten;intBOOK[MAXN];voidInit () {memset (book,1,sizeof(book)); for(inti =2; i < MAXN; i++) { if(Book[i]) for(intj =2*i; J < Maxn; J + =i) book[j]=0; }}intMainvoid) {Init (); intT; scanf ("%d",&t); for(intKase =1; Kase <= t; kase++) { Long Longsum =0; intN; scanf ("%d",&N); while(n--) { intm; scanf ("%d",&m); for(inti = m+1;; i++) { if(Book[i]) {sum+=i; Break; }}} printf ("Case %d:%lld xukha\n", Kase, sum); } return 0;}
LightOJ1370 Bi-shoe and Phi-shoe