結果

問題 No.112 ややこしい鶴亀算
ユーザー Theta
提出日時 2022-10-21 19:29:33
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 556 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-01 04:47:10
合計ジャッジ時間 1,703 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve_tsurukame(leg: int, head: int) -> tuple[int, int]:
    tsuru_head = (leg - 2 * head) // 2
    return tsuru_head, head - tsuru_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 == 0:
                print(N, 0)
            else:
                print(0, N)


if __name__ == "__main__":
    main()
0