結果
問題 | No.1842 Decimal Point |
ユーザー |
![]() |
提出日時 | 2022-02-19 18:38:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 108 ms / 2,000 ms |
コード長 | 661 bytes |
コンパイル時間 | 266 ms |
コンパイル使用メモリ | 41,412 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 10:36:47 |
合計ジャッジ時間 | 1,252 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 |
ソースコード
/* -*- coding: utf-8 -*- * * 1842.cc: No.1842 Decimal Point - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ /* typedef */ typedef long long ll; /* global variables */ /* subroutines */ int powmod(int a, int n, int mod) { // a^n % MOD int pm = 1; while (n > 0) { if (n & 1) pm = (ll)pm * a % mod; a = (ll)a * a % mod; n >>= 1; } return pm; } /* main */ int main() { int tn; scanf("%d", &tn); while (tn--) { int a, b, c; scanf("%d%d%d", &a, &b, &c); int d = (ll)(a % b) * powmod(10, c - 1, b) % b; int e = (ll)d * 10 / b; printf("%d\n", e); } return 0; }