結果

問題 No.5 数字のブロック
ユーザー negistelnegistel
提出日時 2016-04-17 18:24:32
言語 Scala(Beta)
(3.4.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 414 bytes
コンパイル時間 6,498 ms
コンパイル使用メモリ 213,340 KB
最終ジャッジ日時 2023-09-12 00:25:23
合計ジャッジ時間 6,957 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
-- [E006] Not Found Error: Main.scala:3:22 -------------------------------------
3 |        val l : Int = readLine().toInt
  |                      ^^^^^^^^
  |                      Not found: readLine
  |
  | longer explanation available when compiling with `-explain`
-- [E006] Not Found Error: Main.scala:4:22 -------------------------------------
4 |        val n : Int = readLine().toInt
  |                      ^^^^^^^^
  |                      Not found: readLine
  |
  | longer explanation available when compiling with `-explain`
-- [E006] Not Found Error: Main.scala:7:18 -------------------------------------
7 |        for(w <- (readLine().split(' ').map(_.toInt).sorted :+ l+1)){
  |                  ^^^^^^^^
  |                  Not found: readLine
  |
  | longer explanation available when compiling with `-explain`
3 errors found

ソースコード

diff #

object Main {
    def main(args: Array[String]): Unit = {
        val l : Int = readLine().toInt
        val n : Int = readLine().toInt
        var now : Int = 0
        var count : Int = 0
        for(w <- (readLine().split(' ').map(_.toInt).sorted :+ l+1)){
            now += w
            if(now > l){
                println(count)
                return
            }
            count += 1
        }
    }
}
0