結果
問題 | No.1842 Decimal Point |
ユーザー | 👑 potato167 |
提出日時 | 2021-12-05 15:42:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 118 ms / 2,000 ms |
コード長 | 684 bytes |
コンパイル時間 | 2,857 ms |
コンパイル使用メモリ | 192,076 KB |
最終ジャッジ日時 | 2025-01-26 04:34:10 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 |
ソースコード
#include <bits/stdc++.h> using namespace std; using std::cout; using std::cin; using std::endl; using ll=long long; #define rep(i,a) for (ll i=0;i<a;i++) //return x^y (mod z) ll my_pow(ll x,ll y,ll z){ if(x==0) return 0; if(y==0) return 1; if(y%2==1) return (x*my_pow(x,y-1,z))%z; return my_pow((x*x)%z,y/2,z); } int MAX_T=100000; int MAX_A=1000000000; void solve(); int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin>>t; assert(1<=t&&t<=MAX_T); rep(i,t) solve(); } void solve(){ ll A,B,C; cin>>A>>B>>C; assert(1<=A&&A<=MAX_A); assert(1<=B&&B<=MAX_A); assert(1<=C&&C<=MAX_A); ll Y=(A*my_pow(10,C-1,B))%B; cout<<(Y*10ll)/B<<"\n"; return ; }