| 比赛 | 20130923 | 评测结果 | WWWWWWWWWT |
|---|---|---|---|
| 题目名称 | 鬼谷子的钱袋 | 最终得分 | 0 |
| 用户昵称 | /k | 运行时间 | 1.030 s |
| 代码语言 | C++ | 内存使用 | 99.50 MiB |
| 提交时间 | 2015-10-12 21:25:05 | ||
#include<iostream>
#include<cstdio>
using namespace std;
int m,n;
bool b[100000000];
int q[1000000],w;
int main()
{
freopen("wallet.in","r",stdin);
freopen("wallet.out","w",stdout);
scanf("%d",&m);
for(int i=1;;i++)
if(!b[i])
{
if(m<i)
{
n+=m;
break;
}
m-=i;
n++;
for(int y=1;y<=w;y++)
b[i*q[w]]=1;
q[++w]=i;
}
printf("%d\n",n);
for(int i=1;i<=w;i++)
printf("%d ",q[i]);
}