結果

問題 No.1113 二つの整数 / Two Integers
ユーザー simansiman
提出日時 2020-07-25 04:03:56
言語 Ruby
(3.3.0)
結果
AC  
実行時間 81 ms / 1,000 ms
コード長 227 bytes
コンパイル時間 68 ms
コンパイル使用メモリ 11,200 KB
実行使用メモリ 15,308 KB
最終ジャッジ日時 2023-09-08 12:32:51
合計ジャッジ時間 2,356 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,016 KB
testcase_01 AC 81 ms
15,004 KB
testcase_02 AC 81 ms
15,308 KB
testcase_03 AC 80 ms
15,152 KB
testcase_04 AC 80 ms
15,052 KB
testcase_05 AC 80 ms
15,016 KB
testcase_06 AC 78 ms
15,228 KB
testcase_07 AC 80 ms
15,228 KB
testcase_08 AC 80 ms
15,024 KB
testcase_09 AC 79 ms
15,260 KB
testcase_10 AC 80 ms
15,300 KB
testcase_11 AC 79 ms
15,256 KB
testcase_12 AC 80 ms
15,260 KB
testcase_13 AC 81 ms
15,048 KB
testcase_14 AC 81 ms
15,172 KB
testcase_15 AC 79 ms
15,048 KB
testcase_16 AC 80 ms
15,048 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

A, B = gets.split.map(&:to_i)

gcd = A.gcd(B)

ng = 0
ok = 10 ** 18

while (ok - ng).abs > 1
  c = (ok + ng) / 2

  if gcd <= c ** 2
    ok = c
  else
    ng = c
  end
end

if ok ** 2 == gcd
  puts 'Odd'
else
  puts 'Even'
end
0