結果
問題 |
No.1177 余りは?
|
ユーザー |
![]() |
提出日時 | 2022-08-11 17:40:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 20 ms / 1,000 ms |
コード長 | 457 bytes |
コンパイル時間 | 1,787 ms |
コンパイル使用メモリ | 192,056 KB |
最終ジャッジ日時 | 2025-01-30 20:10:16 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 32 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include<bits/stdc++.h> using namespace std; const int MOD=1e9+7; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); ll p,k; cin>>p>>k; ll tmp=10; ll ans=0; rep(i,p-1){ ans=ans*10%MOD; ans=(ans+tmp/p)%MOD; tmp-=tmp/p*p; tmp*=10; } if(k) cout<<ans<<endl; else cout<<(ans+1)%MOD<<endl; return 0; }