PersonalCorpus 版 (精华区)
1247942 Big Guava ... 10049 Accepted
0:00.111 1760 2002/11/19 06:33:12.619
void main()
{
#ifndef ONLINE_JUDGE
freopen("k:\\uva\\i10049","r",stdin);
freopen("k:\\uva\\o10049","w",stdout);
#endif
int i,j,k,l,t,n;
short c[700000];
c[1]=1; c[2]=2; i=2;
for (n=2;i<700000;n++) for (j=0;(j<c[n])&&(i<700000);j++,i++)
c[i]=n;
while (1) {
scanf("%d",&n);
if (n==0) break;
if (n<700000) printf("%d\n",c[n]);
else {
i=1; j=1;
for (k=2;k<700000;k++) {
i=j+1;
j+=c[k];
if ((n>=i)&&(n<=j)) break;
}
printf("%d\n",k);
}
}
}
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:1.963毫秒