The least one
Time limit:9000/3000 MS (java/others) Memory limit:65536/32768 K (java/others)
Total submission (s): 534 Accepted Submission (s): 203
Problem Description in the RPG game ' go back Ice Age ' (I decide to develop the game after my undergraduate education), all Heros has their own respected value, and the skill of killing monsters is defined as the following rule:one hero can Ki LL the monstrers whose respected values is smaller then himself and the both respected values have none common factor but 1 , so the skill is the same as the number of the monsters he can kill. Now each kind of value of the monsters come. And your hero has to kill at least M ones. To minimize the damage of the battle, you should dispatch a hero with minimal respected value. Which hero would you dispatch? There is Q battles, in each battle, for I from 1 to Q, and your hero should kill Mi ones at least. You have all kind of heros with different respected values, and the values (heros ' and Monsters ') is positive.
Input the first line have one integer Q, then Q lines follow. In the Q lines there are an integer Mi, 0<q<=1000000, 0<mi<=10000.
Output for each case, there is Q results, in each result, you should output the value of the hero you'll dispatch to C Omplete the task.
Sample Input237
Sample Output511
Authorwangye
Source2008 "Insigma International Cup" Zhejiang Collegiate Programming Contest-warm up (4)
Recommendwangye | We have carefully selected several similar problems for you:1793 1796 1797 1794 1798 test instructions: Kill Monster game, Hero's ability to be greater than the monster, and both ability is prime, comprehensive can get The answer is greater than the minimum number of primes;
1#include <cstdio>2#include <cstring>3#include <iostream>4 using namespacestd;5 intsieve[10010];6 voidis_prime ()7 {8memset (Sieve,0,sizeof(sieve));9 for(inti =2; i<10010; i++)Ten { One if(Sieve[i] = =0) A { - for(intj =2I j<10010; j+=i) -sieve[j]=1; the } - } - } - intMain () + { - intm, T, I; +scanf"%d", &t); A is_prime (); at while(t--) - { -scanf"%d", &m); - for(i=m+1; i<10010; i++) - if(sieve[i]==0) - Break; inprintf"%d\n", i); - } to return 0; +}
Hangzhou Electric 1795--the least one