DdoubleJ
2018. 8. 9. 11:50
문제에 주어진 조건대로 트리를 따라 그리면 이기는 사람의 규칙이 정해져있다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #include <stdio.h> int main(void) { int T; setbuf(stdout, NULL); scanf("%d", &T); for (int test_case = 1; test_case <= T; test_case++) { unsigned long long n; scanf("%llu", &n); int check = 0; unsigned long long turn = 1; unsigned long long mul = 1; while (turn < n) { if (!check) mul *= 4; turn += mul; check = !check; } printf("#%d %s\n", test_case,check?"Alice":"Bob"); } return 0; } | cs |