結果

問題 No.480 合計
ユーザー samesame
提出日時 2020-02-15 18:28:43
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,048 ms / 2,000 ms
コード長 214 bytes
コンパイル時間 8,508 ms
コンパイル使用メモリ 247,084 KB
実行使用メモリ 63,672 KB
最終ジャッジ日時 2024-04-16 03:16:24
合計ジャッジ時間 32,486 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 987 ms
63,496 KB
testcase_01 AC 989 ms
63,444 KB
testcase_02 AC 999 ms
63,672 KB
testcase_03 AC 991 ms
63,544 KB
testcase_04 AC 1,008 ms
63,620 KB
testcase_05 AC 1,001 ms
63,636 KB
testcase_06 AC 1,004 ms
63,504 KB
testcase_07 AC 1,023 ms
63,600 KB
testcase_08 AC 1,048 ms
63,440 KB
testcase_09 AC 989 ms
63,656 KB
testcase_10 AC 1,008 ms
63,576 KB
testcase_11 AC 993 ms
63,348 KB
testcase_12 AC 1,002 ms
63,484 KB
testcase_13 AC 993 ms
63,644 KB
testcase_14 AC 995 ms
63,364 KB
testcase_15 AC 996 ms
63,260 KB
testcase_16 AC 1,003 ms
63,668 KB
testcase_17 AC 1,008 ms
63,620 KB
testcase_18 AC 1,014 ms
63,620 KB
testcase_19 AC 993 ms
63,664 KB
testcase_20 AC 993 ms
63,500 KB
testcase_21 AC 995 ms
63,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner

object P480 extends App {
  val sc = new Scanner(System.in)
  val n = sc.nextInt()
  println(sum(n))

  def sum(n: Int): Int = n match {
    case 0 => 0
    case _ => n + sum(n - 1)
  }
}
0