fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int n,k,g;
  7. cin>>n>>k;
  8.  
  9. for(int i=0;i<k;i++){
  10. cin>>g;
  11.  
  12. g=g*100/n;
  13.  
  14. if(g<=4)
  15. cout<<1<<" ";
  16. else if(g<=11)
  17. cout<<2<<" ";
  18. else if(g<=23)
  19. cout<<3<<" ";
  20. else if(g<=40)
  21. cout<<4<<" ";
  22. else if(g<=60)
  23. cout<<5<<" ";
  24. else if(g<=77)
  25. cout<<6<<" ";
  26. else if(g<=89)
  27. cout<<7<<" ";
  28. else if(g<=96)
  29. cout<<8<<" ";
  30. else
  31. cout<<9<<" ";
  32. }
  33.  
  34. return 0;
  35. }
Success #stdin #stdout 0.01s 5320KB
stdin
100 9
4 11 23 40 60 77 89 96 100
stdout
1 2 3 4 5 6 7 8 9