結果

問題 No.1140 EXPotentiaLLL!
ユーザー udonmanudonman
提出日時 2020-08-09 18:25:35
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 850 ms / 2,000 ms
コード長 1,057 bytes
コンパイル時間 692 ms
コンパイル使用メモリ 72,816 KB
実行使用メモリ 23,276 KB
最終ジャッジ日時 2024-04-15 11:29:19
合計ジャッジ時間 12,891 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 733 ms
22,936 KB
testcase_01 AC 744 ms
23,148 KB
testcase_02 AC 792 ms
23,192 KB
testcase_03 AC 773 ms
23,088 KB
testcase_04 AC 668 ms
23,176 KB
testcase_05 AC 830 ms
23,168 KB
testcase_06 AC 759 ms
23,040 KB
testcase_07 AC 850 ms
23,168 KB
testcase_08 AC 531 ms
23,276 KB
testcase_09 AC 503 ms
23,200 KB
testcase_10 AC 534 ms
23,168 KB
testcase_11 AC 487 ms
23,116 KB
testcase_12 AC 498 ms
23,168 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:45:18: warning: format ‘%ld’ expects argument of type ‘long int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
   45 |         scanf("%ld",&a);
      |                ~~^  ~~
      |                  |  |
      |                  |  long long int*
      |                  long int*
      |                %lld
main.cpp:46:18: warning: format ‘%ld’ expects argument of type ‘long int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
   46 |         scanf("%ld",&p);
      |                ~~^  ~~
      |                  |  |
      |                  |  long long int*
      |                  long int*
      |                %lld
main.cpp:45:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   45 |         scanf("%ld",&a);
      |         ~~~~~^~~~~~~~~~
main.cpp:46:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   46 |         scanf("%ld",&p);
      |         ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <numeric>
#define ll long long int
#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
using namespace std;

int mx8[] = {0,0,1,-1,-1,1,-1,1};
int my8[] = {-1,1,0,0,-1,-1,1,1};
int mx4[] = {1,-1,0,0};
int my4[] = {0,0,-1,1};
const int MOD = 1000000007;

int y[5000003];


int main() {

    for(int i = 2; i <= 5000002; i++){
        for(int j = 1; j <= 5000002/i; j++){
            y[i*j]++;
        }
    }

    int t; cin >> t;
    rep(test,t){
        ll a,p;
        scanf("%ld",&a);
        scanf("%ld",&p);
        if(y[p] == 1){
            if(a % p == 0) printf("%d\n",0);
            else printf("%d\n",1);
        }else{
            printf("%d\n",-1);
        }
    }


}
0