結果

問題 No.1842 Decimal Point
ユーザー ruthenruthen
提出日時 2022-02-18 21:58:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 714 bytes
コンパイル時間 1,514 ms
コンパイル使用メモリ 162,936 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 19:04:57
合計ジャッジ時間 2,443 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#ifdef _RUTHEN
#include "debug.hpp"
#else
#define show(...) true
#endif

using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(x) begin(x), end(x)
template <class T> using V = vector<T>;

ll modpow(ll a, ll n, ll mod) {
    ll ret = 1;
    while (n) {
        if (n & 1) ret = ret * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ret;
}

void solve() {
    ll a, b, c;
    cin >> a >> b >> c;
    ll d = (a % b) * modpow(10, c - 1, b) % b;
    cout << d * 10 / b << '\n';
    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tt;
    cin >> tt;
    while (tt--) solve();
    return 0;
}
0