PersonalCorpus 版 (精华区)
1234077 Big Guava ... 10019 Accepted
0:00.000 64 2002/11/13 11:17:29.035
void main()
{
#ifndef ONLINE_JUDGE
freopen("k:\\uva\\i10019","r",stdin);
freopen("k:\\uva\\o10019","w",stdout);
#endif
int i,j,k,t,b1,b2;
char s[5];
scanf("%d\n",&t);
while (t--) {
scanf("%d\n",&k);
b1=b2=0;
i=k;
while (i) {
if (i&1) b1++;
i>>=1;
}
sprintf(s,"%d",k);
for (i=0;s[i];i++) {
j=s[i]-48;
while (j) {
if (j&1) b2++;
j>>=1;
}
}
printf("%d %d\n",b1,b2);
}
}
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.004毫秒