結果

問題 No.1842 Decimal Point
ユーザー 👑 hos.lyrichos.lyric
提出日時 2022-02-18 22:14:40
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 1,433 bytes
コンパイル時間 788 ms
コンパイル使用メモリ 96,684 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 19:19:46
合計ジャッジ時間 1,878 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

using Int = long long;

template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }


Int mul(Int a, Int b, Int m) {
  return ((__int128)(a) * b) % m;
}

Int power(Int a, Int e, Int m) {
  Int x = a % m, y = 1 % m;
  for (; e; e >>= 1) {
    if (e & 1) y = mul(y, x, m);
    x = mul(x, x, m);
  }
  return y;
}


int main() {
  for (int numCases; ~scanf("%d", &numCases); ) for (int caseId = 1; caseId <= numCases; ++caseId) {
    Int A, B, C;
    scanf("%lld%lld%lld", &A, &B, &C);
    
    Int t = power(10LL, C, 10LL * B);
    t = mul(t, A, 10LL * B);
    printf("%lld\n", t / B);
  }
  return 0;
}
0