結果

問題 No.1140 EXPotentiaLLL!
ユーザー kotatsugame
提出日時 2020-07-31 23:54:10
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,198 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 583 ms
コンパイル使用メモリ 65,452 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2024-07-06 22:15:05
合計ジャッジ時間 11,875 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-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