結果
問題 | No.1686 Geschenkt |
ユーザー |
![]() |
提出日時 | 2021-12-05 14:56:21 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 39 ms / 2,000 ms |
コード長 | 480 bytes |
コンパイル時間 | 109 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,392 KB |
最終ジャッジ日時 | 2024-07-07 07:50:42 |
合計ジャッジ時間 | 1,201 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
from typing import List ANSWERS = [] N = int(input()) input_list = input().split() input_list = sorted([int(n) for n in input_list]) def geschenkt_rule(pair: List) -> bool: return pair[1] - pair[0] != 1 def main(): ANSWERS.append(input_list[0]) for n in range(1, N): pair: List = [input_list[n - 1], input_list[n]] if geschenkt_rule(pair): ANSWERS.append(input_list[n]) print(sum(ANSWERS)) if __name__ == "__main__": main()