結果

問題 No.1352 Three Coins
ユーザー simansiman
提出日時 2021-01-22 18:57:33
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,669 ms / 2,000 ms
コード長 274 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 11,528 KB
実行使用メモリ 54,520 KB
最終ジャッジ日時 2023-08-27 14:51:10
合計ジャッジ時間 44,143 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,651 ms
54,432 KB
testcase_01 AC 1,533 ms
54,280 KB
testcase_02 AC 1,505 ms
54,468 KB
testcase_03 AC 1,505 ms
54,232 KB
testcase_04 AC 1,507 ms
54,376 KB
testcase_05 AC 1,558 ms
54,316 KB
testcase_06 AC 1,509 ms
54,352 KB
testcase_07 AC 81 ms
15,132 KB
testcase_08 AC 1,494 ms
54,512 KB
testcase_09 AC 1,554 ms
54,236 KB
testcase_10 AC 1,501 ms
54,444 KB
testcase_11 AC 1,445 ms
54,232 KB
testcase_12 AC 81 ms
15,096 KB
testcase_13 AC 1,548 ms
54,332 KB
testcase_14 AC 1,494 ms
54,520 KB
testcase_15 AC 1,440 ms
54,280 KB
testcase_16 AC 83 ms
15,280 KB
testcase_17 AC 1,504 ms
54,472 KB
testcase_18 AC 1,518 ms
54,344 KB
testcase_19 AC 87 ms
15,080 KB
testcase_20 AC 83 ms
15,148 KB
testcase_21 AC 1,503 ms
54,192 KB
testcase_22 AC 81 ms
15,192 KB
testcase_23 AC 81 ms
15,140 KB
testcase_24 AC 1,506 ms
54,496 KB
testcase_25 AC 81 ms
15,140 KB
testcase_26 AC 81 ms
15,088 KB
testcase_27 AC 1,669 ms
54,388 KB
testcase_28 AC 1,372 ms
54,264 KB
testcase_29 AC 1,464 ms
54,344 KB
testcase_30 AC 1,404 ms
54,328 KB
testcase_31 AC 1,394 ms
54,464 KB
testcase_32 AC 1,355 ms
54,408 KB
testcase_33 AC 80 ms
15,200 KB
testcase_34 AC 1,581 ms
54,272 KB
testcase_35 AC 1,624 ms
54,488 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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

if [A, B, C].inject(&:gcd) != 1
  puts 'INF'
  exit
end

LIM = 5 * 10 ** 6 + 1
dp = Array.new(LIM, false)
dp[0] = true

[A, B, C].each do |x|
  x.upto(LIM) do |y|
    next if !dp[y - x]
    dp[y] = true
  end
end

puts dp.count(false)
0