結果

問題 No.1052 電子機器X
ユーザー hedwig100
提出日時 2020-05-15 21:30:08
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 35 ms / 1,000 ms
コード長 460 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-19 08:38:24
合計ジャッジ時間 1,529 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(100000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N,K = map(int,input().split())
    if N%2 == 0:
        if K%2 == 0:
            if 2*K < N:
                ans = K + 1
            else:
                ans = N//2
        else:
            if 2*K < N:
                ans = K + 1
            else:
                ans = N//2
    else:
        ans = min(K + 1,N)
    print(ans)
if __name__ == '__main__':
    main()
0