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