結果

問題 No.1352 Three Coins
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-01-17 16:48:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 282 bytes
コンパイル時間 404 ms
コンパイル使用メモリ 87,264 KB
実行使用メモリ 107,464 KB
最終ジャッジ日時 2023-08-24 23:07:17
合計ジャッジ時間 6,364 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
107,084 KB
testcase_01 AC 136 ms
107,376 KB
testcase_02 AC 143 ms
107,456 KB
testcase_03 AC 147 ms
107,448 KB
testcase_04 AC 145 ms
107,408 KB
testcase_05 AC 145 ms
107,368 KB
testcase_06 AC 144 ms
107,300 KB
testcase_07 AC 74 ms
71,660 KB
testcase_08 AC 144 ms
107,376 KB
testcase_09 AC 144 ms
107,412 KB
testcase_10 AC 144 ms
107,416 KB
testcase_11 AC 145 ms
107,368 KB
testcase_12 AC 72 ms
71,404 KB
testcase_13 AC 144 ms
107,464 KB
testcase_14 AC 144 ms
107,432 KB
testcase_15 AC 145 ms
107,456 KB
testcase_16 AC 76 ms
71,480 KB
testcase_17 AC 148 ms
107,164 KB
testcase_18 AC 143 ms
107,104 KB
testcase_19 AC 73 ms
71,588 KB
testcase_20 AC 74 ms
71,592 KB
testcase_21 AC 146 ms
107,304 KB
testcase_22 AC 75 ms
71,428 KB
testcase_23 AC 74 ms
71,588 KB
testcase_24 AC 138 ms
107,356 KB
testcase_25 AC 73 ms
71,404 KB
testcase_26 AC 72 ms
71,440 KB
testcase_27 AC 137 ms
107,328 KB
testcase_28 AC 145 ms
107,348 KB
testcase_29 AC 135 ms
107,368 KB
testcase_30 AC 146 ms
107,364 KB
testcase_31 AC 145 ms
107,428 KB
testcase_32 AC 148 ms
107,420 KB
testcase_33 AC 75 ms
71,424 KB
testcase_34 AC 139 ms
107,292 KB
testcase_35 AC 141 ms
107,344 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
a,b,c = map(int,input().split())
if math.gcd(a,math.gcd(b,c)) != 1:
    print("INF")
    exit()

M = 4*10**6+5
dp = [0]*M
dp[0] = 1
for i in range(3):
    for j in range(M):
        if j+a < M:
            dp[j+a] = max(dp[j],dp[j+a])
    a,b,c = b,c,a
print(M-sum(dp))
0