結果

問題 No.2814 Block Game
ユーザー usatyousatyo
提出日時 2024-07-19 22:16:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 567 ms / 2,000 ms
コード長 548 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 77,056 KB
最終ジャッジ日時 2024-07-19 22:17:05
合計ジャッジ時間 13,964 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,480 KB
testcase_01 AC 553 ms
76,672 KB
testcase_02 AC 566 ms
76,672 KB
testcase_03 AC 557 ms
76,800 KB
testcase_04 AC 554 ms
76,672 KB
testcase_05 AC 555 ms
76,800 KB
testcase_06 AC 567 ms
76,672 KB
testcase_07 AC 552 ms
77,056 KB
testcase_08 AC 554 ms
76,928 KB
testcase_09 AC 557 ms
76,544 KB
testcase_10 AC 544 ms
76,928 KB
testcase_11 AC 545 ms
77,056 KB
testcase_12 AC 545 ms
76,672 KB
testcase_13 AC 551 ms
76,672 KB
testcase_14 AC 559 ms
76,544 KB
testcase_15 AC 542 ms
76,800 KB
testcase_16 AC 544 ms
76,416 KB
testcase_17 AC 547 ms
76,672 KB
testcase_18 AC 546 ms
76,672 KB
testcase_19 AC 542 ms
76,672 KB
testcase_20 AC 546 ms
77,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def all_two(x):
    while x % 2 == 0:
        x //= 2
    return x == 1


t = int(input())

for _ in range(t):
    n, s = input().split()
    n = int(n)
    if n == 1:
        if s == "Odd":
            print("Alice")
        else:
            print("Bob")
        continue

    if n & 1:
        print("Alice")
    else:
        if all_two(n):
            if (n // 2) % 2 == 0 and s == "Even" or (n // 2) % 2 == 1 and s == "Odd":
                print("Alice")
            else:
                print("Bob")
        else:
            print("Bob")
0