結果

問題 No.1352 Three Coins
ユーザー yuruhiyayuruhiya
提出日時 2021-01-17 16:18:52
言語 Crystal
(1.11.2)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 262 bytes
コンパイル時間 18,926 ms
コンパイル使用メモリ 258,076 KB
実行使用メモリ 8,316 KB
最終ジャッジ日時 2023-09-13 13:05:55
合計ジャッジ時間 22,144 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,400 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 5 ms
4,676 KB
testcase_03 AC 11 ms
5,440 KB
testcase_04 AC 5 ms
4,596 KB
testcase_05 AC 23 ms
6,920 KB
testcase_06 AC 22 ms
6,996 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 20 ms
6,684 KB
testcase_09 AC 7 ms
5,132 KB
testcase_10 AC 14 ms
5,788 KB
testcase_11 AC 14 ms
5,884 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 9 ms
5,288 KB
testcase_14 AC 20 ms
6,440 KB
testcase_15 AC 12 ms
5,360 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 4 ms
4,572 KB
testcase_18 AC 10 ms
5,544 KB
testcase_19 AC 2 ms
4,388 KB
testcase_20 AC 2 ms
4,448 KB
testcase_21 AC 26 ms
7,612 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,404 KB
testcase_24 AC 3 ms
4,400 KB
testcase_25 AC 3 ms
4,376 KB
testcase_26 AC 2 ms
4,456 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 29 ms
7,960 KB
testcase_29 AC 3 ms
4,468 KB
testcase_30 AC 28 ms
8,316 KB
testcase_31 AC 3 ms
4,548 KB
testcase_32 AC 23 ms
8,236 KB
testcase_33 AC 3 ms
4,388 KB
testcase_34 AC 3 ms
4,388 KB
testcase_35 AC 3 ms
4,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b, c = read_line.split.map(&.to_i).sort
puts("INF") + exit if a.gcd(b).gcd(c) != 1
dp = [false] * (b * c)
dp[0] = true
(0...dp.size).each do |i|
  if dp[i]
    {a, b, c}.each do |x|
      dp[i + x] = true if i + x < b*c
    end
  end
end
puts dp.count(false)
0