fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner sc=new Scanner(System.in);
  13. int t=sc.nextInt();
  14. while(t-->0){
  15. int b=sc.nextInt();
  16. int c=0;
  17. while(b!=50){
  18. if(b>50){
  19. b-=3;
  20. c++;
  21. }
  22. else{
  23. b+=2;
  24. c++;
  25. }
  26. }
  27. System.out.println(c);
  28. }
  29. // your code goes here
  30. }
  31. }
Success #stdin #stdout 0.18s 56604KB
stdin
4
51
50
23
0
stdout
2
0
16
25