A. Vasya and Petya's Game

https://codeforc.es/problemset/problem/576/A

思路:每个数可以素因子分解,将每个小于等于k的素因子的t次方的数枚举出来,就可以任意表示k以内的数了;

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
//#include
using namespace std;

#define sfi(i) scanf("%d",&i)
#define sfl(i) scanf("%lld",&i)
#define sfs(i) scanf("%s",(i))
#define pri(i) printf("%d\n",i)
#define prl(i) printf("%lld\n",i)
#define sff(i) scanf("%lf",&i)
#define ll long long
#define ull unsigned long long
#define mem(x,y) memset(x,y,sizeof(x))
#define INF 0x3f3f3f3f
#define eps 1e-10
#define PI acos(-1.0)
#define lowbit(x) ((x)&(-x))
#define fl() printf("flag\n")
#define MOD(x) ((x%mod)+mod)%mod
#define endl '\n'
#define pb push_back
#define lson (rt<<1)
#define rson (rt<<1|1)
#define FAST_IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)

const int maxn=1e7+9;
const int maxm=1e6+9;

bool vis[maxn];
int prime[maxn];
int cnt=0;
void P()
{
    for(int i=2;i>k;
    int num=0;
    for(int i=0;i=prime[i])
        {
            int tmp=prime[i];
            while(k>=tmp)
            {
                p[++num]=tmp;
                tmp*=prime[i];
            }

        }
        else break;

    }
    cout<

 

你可能感兴趣的:(A. Vasya and Petya's Game)