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 t = in.nextInt();
  7. for (int i = 0; i < t; i++)
  8. {
  9. int n = in.nextInt();
  10. double l = n / Math.pow(18, Math.ceil(Math.log(n) / Math.log(18)));
  11. System.out.println((2 * l <= 1) ? 1 : 2);
  12. }
  13. }
  14. }
Success #stdin #stdout 0.1s 35536KB
stdin
4
9
10
1149729
999999999
stdout
1
2
2
1