結果

問題 No.3654 Cup Ramen
コンテスト
ユーザー RYOKO NANAO
提出日時 2026-08-30 15:27:02
言語 Python3
(3.14.7 + numpy 2.5.2 + scipy 1.18.0)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
RE  
実行時間 -
コード長 693 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 298 ms
コンパイル使用メモリ 21,412 KB
実行使用メモリ 21,356 KB
最終ジャッジ日時 2026-08-30 15:27:17
合計ジャッジ時間 7,613 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from pathlib import Path

def my_mma022A_function():
    # 読み込むファイル名(パス)
    current_dir = Path(__file__).parent
    file_path = current_dir / "01_sample_03.txt"

    # with構文を使って安全にファイルを開く
    with open(file_path, "r", encoding="utf-8-sig") as f:
        # 半角スペースや改行で区切られた単語・数値をリストとして取得
        items = f.read().split()

    N = int(items[0])
    X = int(items[1])
    sum = 0
    for i in range(2, len(items)):
        sum += int(items[i])

    answer = sum - X

    if answer < 0 :
        answer = 0

    print(answer)

if __name__ == '__main__':
    my_mma022A_function()
0