結果

問題 No.1842 Decimal Point
ユーザー kokatsukokatsu
提出日時 2022-12-31 14:52:25
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 185 ms / 2,000 ms
コード長 486 bytes
コンパイル時間 2,874 ms
コンパイル使用メモリ 200,040 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-04 19:30:42
合計ジャッジ時間 4,023 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 90 ms
4,380 KB
testcase_02 AC 185 ms
4,380 KB
testcase_03 AC 136 ms
4,380 KB
testcase_04 AC 134 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    long T;
    readf("%d\n", T);

    foreach (_; 0 .. T) {
        long A, B, C;
        readf("%d %d %d\n", A, B, C);

        long res = A * powMod(10, C-1, B) % B * 10 / B;
        res.writeln;
    }
}

long powMod(long x, long y, long z) {
    long res = 1;
    while (y > 0) {
        if (y % 2 == 1) {
            res *= x;
            if (res > z) res %= z;
        }
        x *= x;
        if (x > z) x %= z;
        y /= 2;
    }
    return res;
}
0