結果

問題 No.5 数字のブロック
ユーザー toshiro_yanagi
提出日時 2018-09-17 21:14:30
言語 Nim
(2.2.0)
結果
AC  
実行時間 6 ms / 5,000 ms
コード長 270 bytes
コンパイル時間 4,435 ms
コンパイル使用メモリ 65,596 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-01 04:38:12
合計ジャッジ時間 5,306 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

import strutils, sequtils, algorithm

proc main =
  var
    L, N = parseInt readLine stdin
    W = map(split readLine stdin, parseInt)
    cnt = 0
  #
  sort W, cmp

  for Wi in W:
    if Wi <= L:
      L -= Wi
      cnt += 1
    else: break
  #
  echo cnt
#    
main()
0