Test instructions is to give you a range of 1 to N. You can ask whether the number can be divisible by a number and ask you to guess the few to determine the number ...
At first, there was no way to find out. Each number can be divided into several prime numbers of the whole number of powers multiplied to get ...
1#include <stdio.h>2#include <iostream>3#include <algorithm>4#include <math.h>5#include <string.h>6#include <string>7#include <map>8#include <vector>9#include <queue>Ten #defineM (A, B) memset (A,b,sizeof (a)) One using namespacestd; A intN; - BOOLprime[1005]; - voidinit () { the for(intI=2; i<=n;i++){ - if(!Prime[i]) { - if(i>n/i)Continue; - for(intj=i*i;j<=n;j+=i) +prime[j]=true; - } + } A } at intMain () { -scanf"%d",&n); - init (); - intnum[1005],ans=0; - for(intI=2; i<=n;i++){ - if(!Prime[i]) { innum[ans++]=i; - for(intj=i*i;j<=n;j*=i) tonum[ans++]=J; + } - } theprintf"%d\n", ans); * for(intI=0; i<ans;i++) $printf"%d%c", num[i],i==ans-1?'\ n':' ');Panax Notoginseng return 0; -}
Codeforces 577C Vasya and Petya ' s Game Math