Code=ing
2013年12月6日 星期五
[UVA] 10019 - Funny Encryption Method
#include<stdio.h>
int main(){
int t,n,k,a,b,i,j;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
k=n;
a=b=0;
while(k){
if(k%2) a++;
k/=2;
}
while(n){
k=n%10;
while(k){
if(k%2) b++;
k/=2;
}
n/=10;
}
printf("%d %d\n",a,b);
}
}
沒有留言:
張貼留言
較新的文章
較舊的文章
首頁
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言