fork download
  1. class Main
  2. {
  3. public static void main (String[] args)
  4. {
  5. java.util.Scanner in = new java.util.Scanner(System.in);
  6. int k = in.nextInt();
  7. double n;
  8. for (int i = 0; i < k; i++)
  9. {
  10. n = in.nextInt();
  11. boolean p = true;
  12. while (n > 1)
  13. {
  14. n /= (p ? 9 : 2);
  15. p = !p;
  16. }
  17. System.out.println((p ? 1 : 0) + 1);
  18. }
  19. }
  20. }
Success #stdin #stdout 0.1s 35348KB
stdin
4
9
10
1149729
999999999
stdout
1
2
2
1