結果

問題 No.1140 EXPotentiaLLL!
ユーザー simansiman
提出日時 2020-08-05 02:31:48
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,931 ms / 2,000 ms
コード長 270 bytes
コンパイル時間 367 ms
コンパイル使用メモリ 11,372 KB
実行使用メモリ 39,596 KB
最終ジャッジ日時 2023-10-13 06:36:41
合計ジャッジ時間 15,678 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,166 ms
20,776 KB
testcase_01 AC 1,117 ms
20,928 KB
testcase_02 AC 1,198 ms
20,872 KB
testcase_03 AC 1,329 ms
39,400 KB
testcase_04 AC 1,028 ms
39,364 KB
testcase_05 AC 1,745 ms
39,304 KB
testcase_06 AC 1,535 ms
39,408 KB
testcase_07 AC 1,931 ms
39,596 KB
testcase_08 AC 105 ms
20,716 KB
testcase_09 AC 106 ms
20,720 KB
testcase_10 AC 105 ms
20,648 KB
testcase_11 AC 106 ms
20,624 KB
testcase_12 AC 107 ms
20,568 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:21: warning: ambiguous first argument; put parentheses or a space even after `-' operator
Syntax OK

ソースコード

diff #

require 'openssl'
require 'prime'

T = gets.to_i
memo = Hash.new

T.times do
  a, pv = gets.split.map(&:to_i)

  if memo[pv].nil?
    memo[pv] = pv.prime?
  end

  if memo[pv]
    if a.gcd(pv) == 1
      puts 1
    else
      puts 0
    end
  else
    puts -1
  end
end
0