結果
| 問題 |
No.112 ややこしい鶴亀算
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-10-21 19:33:52 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 5,000 ms |
| コード長 | 553 bytes |
| コンパイル時間 | 121 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-07-01 04:52:02 |
| 合計ジャッジ時間 | 1,743 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
def solve_tsurukame(leg: int, head: int) -> tuple[int, int]:
kame_head = (leg - 2 * head) // 2
return head - kame_head, kame_head
def main():
N = int(input())
legs = set(map(int, input().split()))
match len(legs):
case 2:
actual_legs = max(legs) + 2
print(*solve_tsurukame(actual_legs, N))
case 1:
false_legs = legs.pop()
if (false_legs + 2) == N * 2:
print(N, 0)
else:
print(0, N)
if __name__ == "__main__":
main()