fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. /* Name of the class has to be "Main" only if the class is public. */
  6. class Codechef
  7. {
  8. public static void main (String[] args) throws java.lang.Exception
  9. {
  10. int t;
  11. t=Integer.parseInt(br.readLine());
  12. while(t--!=0)
  13. {
  14. int m;
  15. m=Integer.parseInt(br.readLine());
  16. int x=0,y=0,n;
  17. n=m;
  18. if(m==0)
  19. System.out.println(x+" "+y);
  20. if(m==1)
  21. System.out.println((x++)+" "+y);
  22. while(m--!=0)
  23. {
  24. if(m%2==0)
  25. x++;
  26. else
  27. y=n-x;
  28. }
  29. int g=x;
  30. g--;
  31. System.out.println(g+" "+y);
  32.  
  33. }
  34. }
  35. }
Success #stdin #stdout 0.05s 4386816KB
stdin
1
6
stdout
2 4