結果
問題 | No.1177 余りは? |
ユーザー |
|
提出日時 | 2020-08-21 23:09:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 21 ms / 1,000 ms |
コード長 | 270 bytes |
コンパイル時間 | 467 ms |
コンパイル使用メモリ | 63,380 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-15 06:33:00 |
合計ジャッジ時間 | 1,750 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; }