1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#include <stdio.h> const char LAST[] = "0923"; int main() { int t, c; long n; scanf("%d", &t); while (t--) { scanf("%ld", &n); if (n == 2 || n == 3) { puts("1"); continue; } for (c = 0; n >>= 1; c++); printf("%c\n", LAST[c % 4]); } return 0; }