結果
問題 |
No.5 数字のブロック
|
ユーザー |
![]() |
提出日時 | 2016-03-13 14:25:51 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 658 bytes |
コンパイル時間 | 72 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-25 11:15:42 |
合計ジャッジ時間 | 1,517 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 34 |
ソースコード
#fileencoding: utf-8 from __future__ import print_function import sys def usage(): arg = "filename" print("usage: python %s %s"%(sys.argv[0], arg)) sys.exit() def main(): with open(sys.argv[1]) as f: for i, v in enumerate(f): if i == 0: L = int(v) elif i == 1: N = int(v) elif i == 2: W = [int(j) for j in v.strip().split(" ")] count = 0 for i in sorted(W): L -= i if L > 0: count += 1 print(count) if __name__ == "__main__": if len(sys.argv) != 2: usage() main()