結果

問題 No.1140 EXPotentiaLLL!
ユーザー kotatsugamekotatsugame
提出日時 2020-07-31 23:54:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,201 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 438 ms
コンパイル使用メモリ 65,448 KB
実行使用メモリ 8,636 KB
最終ジャッジ日時 2023-09-21 03:36:23
合計ジャッジ時間 11,963 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,201 ms
8,496 KB
testcase_01 AC 1,197 ms
8,636 KB
testcase_02 AC 1,192 ms
8,484 KB
testcase_03 AC 900 ms
8,480 KB
testcase_04 AC 686 ms
8,436 KB
testcase_05 AC 1,060 ms
8,560 KB
testcase_06 AC 1,022 ms
8,428 KB
testcase_07 AC 1,191 ms
8,480 KB
testcase_08 AC 43 ms
8,432 KB
testcase_09 AC 42 ms
8,616 KB
testcase_10 AC 42 ms
8,432 KB
testcase_11 AC 42 ms
8,504 KB
testcase_12 AC 42 ms
8,508 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int T;
long A,P;
bool isp[5<<20];
main()
{
	isp[1]=true;
	for(int i=2;i<5<<20;i++)if(!isp[i])
	{
		for(int j=i+i;j<5<<20;j+=i)isp[j]=true;
	}
	cin>>T;
	for(;T--;)
	{
		cin>>A>>P;
		if(!isp[P])
		{
			A%=P;
			cout<<(A?1:0)<<endl;
		}
		else
		{
			cout<<-1<<endl;
		}
	}
}
0