結果

問題 No.2386 Udon Coupon (Easy)
ユーザー mono_0812mono_0812
提出日時 2023-07-21 21:38:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 372 ms / 2,000 ms
コード長 1,941 bytes
コンパイル時間 132 ms
コンパイル使用メモリ 12,208 KB
実行使用メモリ 20,724 KB
最終ジャッジ日時 2023-10-21 21:33:59
合計ジャッジ時間 8,882 ms
ジャッジサーバーID
(参考情報)
judge12 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
11,460 KB
testcase_01 AC 34 ms
11,460 KB
testcase_02 AC 35 ms
11,476 KB
testcase_03 AC 33 ms
11,460 KB
testcase_04 AC 31 ms
11,460 KB
testcase_05 AC 32 ms
11,460 KB
testcase_06 AC 33 ms
11,472 KB
testcase_07 AC 357 ms
20,724 KB
testcase_08 AC 33 ms
11,460 KB
testcase_09 AC 32 ms
11,460 KB
testcase_10 AC 115 ms
13,740 KB
testcase_11 AC 67 ms
12,324 KB
testcase_12 AC 310 ms
18,348 KB
testcase_13 AC 372 ms
20,460 KB
testcase_14 AC 311 ms
19,140 KB
testcase_15 AC 333 ms
20,460 KB
testcase_16 AC 266 ms
18,084 KB
testcase_17 AC 305 ms
19,668 KB
testcase_18 AC 155 ms
14,944 KB
testcase_19 AC 55 ms
12,060 KB
testcase_20 AC 256 ms
17,556 KB
testcase_21 AC 317 ms
19,668 KB
testcase_22 AC 200 ms
16,264 KB
testcase_23 AC 179 ms
15,736 KB
testcase_24 AC 85 ms
12,852 KB
testcase_25 AC 234 ms
17,056 KB
testcase_26 AC 333 ms
19,404 KB
testcase_27 AC 345 ms
20,724 KB
testcase_28 AC 184 ms
15,736 KB
testcase_29 AC 121 ms
14,048 KB
testcase_30 AC 51 ms
11,948 KB
testcase_31 AC 170 ms
15,472 KB
testcase_32 AC 59 ms
12,060 KB
testcase_33 AC 362 ms
20,724 KB
testcase_34 AC 196 ms
16,264 KB
testcase_35 AC 274 ms
18,084 KB
testcase_36 AC 355 ms
20,460 KB
testcase_37 AC 277 ms
18,348 KB
testcase_38 AC 211 ms
16,792 KB
testcase_39 AC 166 ms
15,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

############################################################################################
import bisect,collections,copy,heapq,itertools,math,string,sys,queue,time,random
from decimal import Decimal
def I(): return input()
def IS(): return input().split()
def II(): return int(input())
def IIS(): return list(map(int,input().split()))
def LIIS(): return list(map(int,input().split()))

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

import math

def prime_numbers(n):
    prime = [True for i in range(n+1)]
    prime[0] = False
    prime[1] = False

    sqrt_n = math.ceil(math.sqrt(n))
    for i in range(2, sqrt_n):
        if prime[i]:
            for j in range(2*i, n+1, i):
                prime[j] = False
    numbers=[]
    for i in range(2,n+1):
        if prime[i]:
            numbers.append(i)

    return numbers

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
 
    if temp!=1:
        arr.append([temp, 1])
 
    if arr==[]:
        arr.append([n, 1])
 
    return arr
 
INF=1<<63
MOD=998244353
MOD2=10**9+7
sys.setrecursionlimit(500005)
alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
def bit_count(x):
    return bin(x).count("1")
def yesno(f):
    if f:print("Yes")
    else:print("No")
####################################################
n=II()
a,b,c=IIS()
dp=[0 for i in range(n+1)]
for i in range(n):
    if i+3<=n:
        dp[i+3]=max(dp[i+3],dp[i]+a)
    if i+5<=n:
        dp[i+5]=max(dp[i+5],dp[i]+b)   
    if i+10<=n:
        dp[i+10]=max(dp[i+10],dp[i]+c)
print(max(dp[:n+1]))
0