結果

問題 No.1047 Zero (Novice)
ユーザー 👑 yumechiyumechi
提出日時 2021-03-01 01:54:38
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,099 ms / 2,000 ms
コード長 297 bytes
コンパイル時間 10,444 ms
コンパイル使用メモリ 269,872 KB
実行使用メモリ 65,456 KB
最終ジャッジ日時 2024-04-14 03:30:11
合計ジャッジ時間 33,879 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,040 ms
65,116 KB
testcase_01 AC 1,018 ms
65,412 KB
testcase_02 AC 1,051 ms
65,248 KB
testcase_03 AC 1,062 ms
65,348 KB
testcase_04 AC 1,068 ms
65,284 KB
testcase_05 AC 1,071 ms
65,104 KB
testcase_06 AC 1,064 ms
65,452 KB
testcase_07 AC 1,054 ms
65,336 KB
testcase_08 AC 1,038 ms
65,104 KB
testcase_09 AC 1,045 ms
65,248 KB
testcase_10 AC 998 ms
65,404 KB
testcase_11 AC 968 ms
65,248 KB
testcase_12 AC 979 ms
65,376 KB
testcase_13 AC 1,086 ms
65,276 KB
testcase_14 AC 1,099 ms
65,456 KB
testcase_15 AC 970 ms
65,208 KB
testcase_16 AC 962 ms
65,236 KB
testcase_17 AC 964 ms
65,232 KB
testcase_18 AC 950 ms
65,268 KB
testcase_19 AC 967 ms
65,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner

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

  val a = sc.nextLong
  val b = sc.nextLong


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