結果

問題 No.1842 Decimal Point
ユーザー kai4096_donkai4096_don
提出日時 2022-02-18 22:09:29
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 301 ms / 2,000 ms
コード長 783 bytes
コンパイル時間 3,684 ms
コンパイル使用メモリ 225,856 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 19:16:57
合計ジャッジ時間 5,379 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
//const long nPrime = 1000000007;
//const long nPrime = 998244353;
typedef long long ll;
long LF_Pow(long nBase, long nExp, long nMod){
    if(nExp < 0){
        return -1;
    }
    long iTmp = nBase % nMod;
    long nReturn = 1;
    while (nExp > 0){
        if(nExp % 2 == 1){
            nReturn *= iTmp;
            nReturn %= nMod;
        }
        iTmp = iTmp * iTmp;  
        iTmp %= nMod;
        nExp /= 2;
    }
    return nReturn;    
}
int main() {
    long t;
    cin >> t;
    while(t--){
        long a,b,c;
        cin >> a >> b >> c;
        long x = LF_Pow(10, c-1,b);
        x *= a;
        x %= b;
        x *= 10;
        cout << x/b << endl;
    }
    return 0;
}
0