Download uva_cpp_clean/10019/10019-5.cpp from slayone/uva_spoj_raw: direct link, hf CLI and curl.
- Browser
- Download file 863 Bytes
-
https://huggingface.co/datasets/slayone/uva_spoj_raw/resolve/main/uva_cpp_clean/10019/10019-5.cpp
- Command line
-
hf download hf://datasets/slayone/uva_spoj_raw/uva_cpp_clean/10019/10019-5.cpp
-
curl -L -o 10019-5.cpp https://huggingface.co/datasets/slayone/uva_spoj_raw/resolve/main/uva_cpp_clean/10019/10019-5.cpp
863 Bytes
| using namespace std; | |
| int a[1000],b[1000]; | |
| int binary(int n) | |
| { | |
| int s,c=0; | |
| while(n!=0) | |
| { | |
| s=n%2; | |
| n=n/2; | |
| if(s==1) | |
| c++; | |
| } | |
| return c; | |
| } | |
| int hex(int n) | |
| { | |
| int s,c=0; | |
| while(n!=0) | |
| { | |
| s=n%10; | |
| n=n/10; | |
| if(s==0) | |
| c+=0; | |
| else if (s==1||s==2||s==4||s==8) | |
| c+=1; | |
| else if (s==3||s==5||s==6||s==9) | |
| c+=2; | |
| else if(s==7) | |
| c+=3; | |
| } | |
| return c; | |
| } | |
| int main() | |
| { | |
| int n,m; | |
| scanf("%d",&n); | |
| while(n--) | |
| { | |
| scanf("%d",&m); | |
| int b=binary(m); | |
| int c=hex(m); | |
| printf("%d %d\n",b,c); | |
| } | |
| return 0; | |
| } | |