結果

問題 No.5 数字のブロック
コンテスト
ユーザー negistel
提出日時 2016-04-17 18:24:32
言語 Scala(Beta)
(3.8.1)
コンパイル:
scalac _filename_
実行:
java -cp .:/home/linuxbrew/.linuxbrew/Cellar/scala/3.8.1/libexec/maven2/org/scala-lang/scala3-library_3/3.8.1/scala3-library_3-3.8.1.jar:/home/linuxbrew/.linuxbrew/Cellar/scala/3.8.1/libexec/maven2/org/scala-lang/scala-library/3.8.1/scala-library-3.8.1.jar _class_
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 414 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,341 ms
コンパイル使用メモリ 215,680 KB
最終ジャッジ日時 2026-03-09 14:40:55
合計ジャッジ時間 5,733 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、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 #
raw source code

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