結果

問題 No.1352 Three Coins
ユーザー vwxyzvwxyz
提出日時 2023-11-21 07:54:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 451 ms / 2,000 ms
コード長 993 bytes
コンパイル時間 194 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 128,616 KB
最終ジャッジ日時 2023-11-21 07:54:16
合計ジャッジ時間 15,833 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 358 ms
128,616 KB
testcase_01 AC 364 ms
128,612 KB
testcase_02 AC 400 ms
128,612 KB
testcase_03 AC 401 ms
128,612 KB
testcase_04 AC 398 ms
128,612 KB
testcase_05 AC 387 ms
128,612 KB
testcase_06 AC 416 ms
128,616 KB
testcase_07 AC 345 ms
128,488 KB
testcase_08 AC 390 ms
128,616 KB
testcase_09 AC 393 ms
128,612 KB
testcase_10 AC 395 ms
128,612 KB
testcase_11 AC 417 ms
128,616 KB
testcase_12 AC 340 ms
128,488 KB
testcase_13 AC 383 ms
128,612 KB
testcase_14 AC 381 ms
128,616 KB
testcase_15 AC 372 ms
128,612 KB
testcase_16 AC 371 ms
128,484 KB
testcase_17 AC 393 ms
128,616 KB
testcase_18 AC 391 ms
128,612 KB
testcase_19 AC 357 ms
128,492 KB
testcase_20 AC 369 ms
128,492 KB
testcase_21 AC 386 ms
128,616 KB
testcase_22 AC 364 ms
128,484 KB
testcase_23 AC 331 ms
128,488 KB
testcase_24 AC 387 ms
128,612 KB
testcase_25 AC 393 ms
128,488 KB
testcase_26 AC 350 ms
128,492 KB
testcase_27 AC 451 ms
128,612 KB
testcase_28 AC 375 ms
128,612 KB
testcase_29 AC 440 ms
128,616 KB
testcase_30 AC 400 ms
128,616 KB
testcase_31 AC 406 ms
128,600 KB
testcase_32 AC 378 ms
128,616 KB
testcase_33 AC 315 ms
128,484 KB
testcase_34 AC 410 ms
128,592 KB
testcase_35 AC 340 ms
128,616 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import copy
import decimal
import fractions
import heapq
import itertools
import math
import random
import sys
import time
from collections import Counter,deque,defaultdict
from functools import lru_cache,reduce
from heapq import heappush,heappop,heapify,heappushpop,_heappop_max,_heapify_max
def _heappush_max(heap,item):
    heap.append(item)
    heapq._siftdown_max(heap, 0, len(heap)-1)
def _heappushpop_max(heap, item):
    if heap and item < heap[0]:
        item, heap[0] = heap[0], item
        heapq._siftup_max(heap, 0)
    return item
from math import gcd as GCD
read=sys.stdin.read
readline=sys.stdin.readline
readlines=sys.stdin.readlines
write=sys.stdout.write
#import pypyjit
#pypyjit.set_param('max_unroll_recursion=-1')
#sys.set_int_max_str_digits(10**9)

A,B,C=map(int,readline().split())
X=5*10**6
dp=[False]*X
dp[0]=True
for a in (A,B,C):
    for i in range(a,X):
        dp[i]|=dp[i-a]
if GCD(A,B,C)!=1:
    ans="INF"
else:
    ans=dp.count(False)
print(ans)
0