結果

問題 No.1842 Decimal Point
ユーザー yudedakoyudedako
提出日時 2022-02-28 17:27:23
言語 Scala(Beta)
(3.4.0)
結果
AC  
実行時間 1,658 ms / 2,000 ms
コード長 700 bytes
コンパイル時間 12,208 ms
コンパイル使用メモリ 269,308 KB
実行使用メモリ 69,976 KB
最終ジャッジ日時 2023-09-21 01:53:17
合計ジャッジ時間 21,937 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 977 ms
62,596 KB
testcase_01 AC 1,594 ms
69,976 KB
testcase_02 AC 1,658 ms
69,648 KB
testcase_03 AC 1,650 ms
69,440 KB
testcase_04 AC 1,625 ms
69,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import scala.collection.mutable.*
import scala.io.StdIn.*
import scala.util.chaining.*
import scala.math.*
import scala.reflect.ClassTag
import scala.util.*
import scala.annotation.tailrec
import scala.collection.mutable



extension (value: Int)
  def powMod(exp: Int, mod: Int): Long =
    var result = 1L
    var base = value.toLong % mod
    var e = exp
    while e > 0 do
      if (e & 1) == 1 then
        result = result * base % mod
      base = base * base % mod
      e >>= 1
    result

@main def main =
  val testCase = readLine.toInt
  for _ <- 0 until testCase do
    val Array(a, b, c) = readLine.split(' ').map(_.toInt)
    val r = a * 10.powMod(c - 1, b) % b
    println(r * 10 / b)
0