結果
問題 |
No.1177 余りは?
|
ユーザー |
|
提出日時 | 2020-08-21 23:18:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 22 ms / 1,000 ms |
コード長 | 269 bytes |
コンパイル時間 | 483 ms |
コンパイル使用メモリ | 63,104 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 06:33:41 |
合計ジャッジ時間 | 1,712 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 32 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; long P,K; const long mod=1e9+7; bool ex[1<<20]; main() { cin>>P>>K; long ans=0; long now=1; while(!ex[now]) { ex[now]=true; now=now*10; ans=(ans*10+now/P)%mod; now%=P; } if(K==0)ans=(ans+1)%mod; cout<<ans<<endl; }