fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. int a[10]={1,2,4,8,16,32,64,128,256,512};
  6. int i,x;
  7. scanf("%d",&x);
  8. for(i=9;0>=i;i--){
  9. if(x>=a[i]){
  10. x=x-a[i];
  11. printf("%d",x);
  12. }
  13. }
  14. printf("\n");
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0.01s 5316KB
stdin
200
stdout