結果
| 問題 |
No.524 コインゲーム
|
| ユーザー |
|
| 提出日時 | 2021-06-06 05:31:28 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 41 ms / 1,000 ms |
| コード長 | 685 bytes |
| コンパイル時間 | 152 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,392 KB |
| 最終ジャッジ日時 | 2024-11-22 08:48:30 |
| 合計ジャッジ時間 | 2,748 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
#!/usr/bin/env python3
# from typing import *
import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq
def input():
return sys.stdin.readline()[:-1]
# sys.setrecursionlimit(1000000)
# _INPUT = """1
# """
# sys.stdin = io.StringIO(_INPUT)
def f(N):
if N == 0:
return 0
elif N == 1:
return 1
elif N == 2:
return 3
elif N == 3:
return 0
N1 = N
d = 0
while N1 > 1:
N1 >>= 1
d += 1
if N % 2 == 0:
return (1<<d) + f(N-(1<<d))
else:
return f(N-(1<<d))
N = int(input())
g = f(N)
if g == 0:
print('X')
else:
print('O')