結果
問題 |
No.1140 EXPotentiaLLL!
|
ユーザー |
![]() |
提出日時 | 2020-08-01 23:48:52 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 620 bytes |
コンパイル時間 | 302 ms |
コンパイル使用メモリ | 28,160 KB |
最終ジャッジ日時 | 2025-01-12 13:00:15 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 RE * 8 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:18:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long int*’ [-Wformat=] 18 | scanf("%d %d", &a, &p); | ~^ ~~ | | | | int* long int* | %ld main.cpp:18:20: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘long int*’ [-Wformat=] 18 | scanf("%d %d", &a, &p); | ~^ ~~ | | | | int* long int* | %ld main.cpp:15:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%d", &t); | ~~~~~^~~~~~~~~~ main.cpp:18:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%d %d", &a, &p); | ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio> int main() { bool isprime[500001]; isprime[1] = false; for (int i = 2; i <= 500000; i++) { isprime[i] = true; } for (int i = 2; i * i <= 500000; i++) { for (int j = 2; j * i <= 500000; j++) { isprime[j * i] = false; } } int t; scanf("%d", &t); for (int i = 0; i < t; i++) { long a, p; scanf("%d %d", &a, &p); if (isprime[p]) { if (a % p == 0) { puts("0"); } else { puts("1"); } } else { puts("-1"); } } }