結果

問題 No.1089 三変数方程式
ユーザー 👑 yumechiyumechi
提出日時 2021-03-01 23:44:53
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,087 ms / 2,000 ms
コード長 276 bytes
コンパイル時間 9,140 ms
コンパイル使用メモリ 270,992 KB
実行使用メモリ 65,540 KB
最終ジャッジ日時 2024-04-14 04:02:58
合計ジャッジ時間 28,605 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 984 ms
65,448 KB
testcase_01 AC 985 ms
65,444 KB
testcase_02 AC 991 ms
65,276 KB
testcase_03 AC 1,056 ms
65,404 KB
testcase_04 AC 1,006 ms
65,364 KB
testcase_05 AC 1,078 ms
65,516 KB
testcase_06 AC 1,029 ms
65,496 KB
testcase_07 AC 1,038 ms
65,540 KB
testcase_08 AC 1,067 ms
65,440 KB
testcase_09 AC 1,010 ms
65,344 KB
testcase_10 AC 1,053 ms
65,440 KB
testcase_11 AC 1,017 ms
65,412 KB
testcase_12 AC 1,036 ms
65,440 KB
testcase_13 AC 1,020 ms
65,168 KB
testcase_14 AC 1,052 ms
65,448 KB
testcase_15 AC 1,087 ms
65,356 KB
testcase_16 AC 1,062 ms
65,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)

  val n = sc.nextInt
  var ans = 0
  for(i <- 0 to n) {
    for(j <- 0 to (n - i)) {
      val k = n - (i + j)
      if(i + j + k == n) {
        ans += 1
      }
    }
  }
  println(ans)
}
0