結果

問題 No.5 数字のブロック
ユーザー toshiro_yanagi
提出日時 2018-06-01 20:50:01
言語 Nim
(2.2.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 231 bytes
コンパイル時間 3,335 ms
コンパイル使用メモリ 65,536 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-30 08:56:16
合計ジャッジ時間 4,481 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, sequtils, algorithm
var
  L, N = stdin.readLine.parseInt
  W = stdin.readLine.split.map(parseInt)
  cnt = 0

W.sort(cmp)

for i in 0 ..< W.len:
  if L < W[i]:
    break
  else:
    cnt += 1
    L -= W[i]

echo cnt
0