結果

問題 No.1177 余りは?
ユーザー kotatsugamekotatsugame
提出日時 2020-08-21 23:08:01
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 294 bytes
コンパイル時間 668 ms
コンパイル使用メモリ 72,644 KB
実行使用メモリ 50,560 KB
最終ジャッジ日時 2024-04-23 06:44:30
合計ジャッジ時間 17,302 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 351 ms
22,016 KB
testcase_01 TLE -
testcase_02 AC 241 ms
17,408 KB
testcase_03 AC 788 ms
36,864 KB
testcase_04 AC 357 ms
21,760 KB
testcase_05 AC 457 ms
25,600 KB
testcase_06 AC 79 ms
9,472 KB
testcase_07 AC 65 ms
9,216 KB
testcase_08 TLE -
testcase_09 AC 888 ms
39,552 KB
testcase_10 AC 10 ms
6,940 KB
testcase_11 AC 523 ms
27,904 KB
testcase_12 AC 57 ms
8,192 KB
testcase_13 AC 117 ms
12,032 KB
testcase_14 AC 176 ms
14,720 KB
testcase_15 AC 310 ms
19,968 KB
testcase_16 AC 211 ms
16,128 KB
testcase_17 TLE -
testcase_18 AC 414 ms
23,680 KB
testcase_19 AC 650 ms
32,000 KB
testcase_20 AC 124 ms
12,160 KB
testcase_21 AC 550 ms
28,672 KB
testcase_22 AC 966 ms
42,112 KB
testcase_23 AC 420 ms
24,448 KB
testcase_24 AC 244 ms
16,512 KB
testcase_25 AC 771 ms
37,248 KB
testcase_26 AC 979 ms
42,752 KB
testcase_27 AC 125 ms
12,032 KB
testcase_28 AC 524 ms
27,904 KB
testcase_29 AC 468 ms
25,728 KB
testcase_30 AC 443 ms
25,472 KB
testcase_31 AC 648 ms
31,872 KB
testcase_32 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<set>
using namespace std;
long P,K;
const long mod=1e9+7;
main()
{
	cin>>P>>K;
	long ans=0;
	long now=1;
	set<long>S;
	while(S.find(now)==S.end())
	{
		S.insert(now);
		now=now*10;
		ans=(ans*10+now/P)%mod;
		now%=P;
	}
	if(K==0)ans=(ans+1)%mod;
	cout<<ans<<endl;
}
0