fork download
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int T, N, bits, nibbles, bytes, no26, x;
  8. cin>>T;
  9. while(T>0)
  10. {
  11. cin>>N;
  12. if(N<1)
  13. continue;
  14. no26=0;
  15. bits=0;
  16. nibbles=0;
  17. bytes=0;
  18.  
  19. while(N>26)
  20. {
  21. N-=26;
  22. no26++;
  23. }
  24.  
  25. x=pow(2,no26);
  26.  
  27. if(N>10)
  28. {
  29. bytes=x;
  30. }
  31. else if(N>2)
  32. {
  33. nibbles=x;
  34. }
  35. else
  36. {
  37. bits=x;
  38. }
  39.  
  40. cout<<bits<<" "<<nibbles<<" "<<bytes<<endl;
  41. T--;
  42. }
  43. }
  44.  
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
Standard output is empty