結果

問題 No.1047 Zero (Novice)
ユーザー 👑 yumechiyumechi
提出日時 2021-03-01 01:53:05
言語 Scala(Beta)
(3.4.0)
結果
WA  
実行時間 -
コード長 292 bytes
コンパイル時間 8,524 ms
コンパイル使用メモリ 266,156 KB
実行使用メモリ 65,456 KB
最終ジャッジ日時 2024-04-14 03:29:35
合計ジャッジ時間 29,316 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 937 ms
65,340 KB
testcase_01 AC 938 ms
65,300 KB
testcase_02 AC 945 ms
65,364 KB
testcase_03 AC 940 ms
65,180 KB
testcase_04 AC 939 ms
65,184 KB
testcase_05 AC 942 ms
65,188 KB
testcase_06 AC 939 ms
65,296 KB
testcase_07 AC 939 ms
65,364 KB
testcase_08 AC 934 ms
65,424 KB
testcase_09 AC 937 ms
65,376 KB
testcase_10 AC 942 ms
65,284 KB
testcase_11 AC 942 ms
65,372 KB
testcase_12 AC 938 ms
65,136 KB
testcase_13 AC 940 ms
65,360 KB
testcase_14 AC 933 ms
65,320 KB
testcase_15 AC 944 ms
65,456 KB
testcase_16 AC 938 ms
65,228 KB
testcase_17 AC 940 ms
65,248 KB
testcase_18 AC 936 ms
65,364 KB
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner

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

  val a = sc.nextInt
  val b = sc.nextInt


  def solve(a: Int, b: Int): Int = {
    var n = 0
    for(i <- 1 to 3) {
      n = a * n + b
      if(n == 0) return i
    }
    -1
  }
  println(solve(a, b))
}
0