PersonalCorpus 版 (精华区)
1248523 Big Guava ... 344 Accepted
0:00.000 64 2002/11/19 11:48:52.661
void main()
{
#ifndef ONLINE_JUDGE
freopen("k:\\uva\\i344","r",stdin);
freopen("k:\\uva\\o344","w",stdout);
#endif
int n,m;
int i,v,x,l,c;
while (1) {
i=v=x=l=c=0;
scanf("%d",&m);
if (m==0) break;
for (n=1;n<=m;n++) {
switch( n/10 ) {
case 1: x++; break;
case 2: x+=2; break;
case 3: x+=3; break;
case 4: x++; l++; break;
case 5: l++; break;
case 6: l++; x++; break;
case 7: l++; x+=2; break;
case 8: l++; x+=3; break;
case 9: x++; c++; break;
case 10: c++; break;
}
switch ( n% 10 ) {
case 1: i++; break;
case 2: i+=2; break;
case 3: i+=3; break;
case 4: i++; v++; break;
case 5: v++; break;
case 6: v++; i++; break;
case 7: v++; i+=2; break;
case 8: v++; i+=3; break;
case 9: i++; x++; break;
}
}
printf("%d: %d i, %d v, %d x, %d l, %d c\n",m,i,v,x,l,c);
}
}
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:1.924毫秒