結果
問題 |
No.1140 EXPotentiaLLL!
|
ユーザー |
![]() |
提出日時 | 2021-05-07 18:56:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 467 bytes |
コンパイル時間 | 4,801 ms |
コンパイル使用メモリ | 336,848 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-15 07:10:24 |
合計ジャッジ時間 | 8,088 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 RE * 8 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <boost/multiprecision/cpp_int.hpp> namespace mp=boost::multiprecision; int main(){ int N; cin>>N; long long A,P; vector<int> M(500001,1); M[1]=0; for(int i=2;i<500001;i++){ if(M[i]){ for(int j=i*2;j<500001;j+=i){ M[j]=0; } } } for(int i=0;i<N;i++){ cin>>A>>P; cout<<(M[P]*(1+(A%P!=0))-1)<<endl; } }