Problem: A programming competition site _AtCode_ provides algorithmic problems. Each problem is allocated a score based on its difficulty. Currently, for each integer i between 1 and D (inclusive), there are p_i problems with a score of 100i points. These p_1 + … + p_D problems are all of the problems available on AtCode.  A user of AtCode has a value called _total score_. The total score of a user is the sum of the following two elements:    * Base score: the sum of the scores of all problems solved by the user.   * Perfect bonuses: when a user solves all problems with a score of 100i points, he/she earns the perfect bonus of c_i points, aside from the base score (1 ≤ i ≤ D).  Takahashi, who is the new user of AtCode, has not solved any problem. His objective is to have a total score of G or more points. At least how many problems does he need to solve for this objective?

Submission attempts (in order):
import math

d, g = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(d)]

for k,i in enumerate(lst):
    i.append((k+1)*100)
    i.append(i[2]*i[0]+i[1])

def calcurate(pt, count, g, lst):
    lst1 = list()
    for i in lst:
        if i[3] > g - pt:
            lst1.append(i + [i[2]])
        else:
            lst1.append(i + [i[3]/i[0]])
    lst1 = sorted(lst1, key = lambda x: -x[-1])
    ps = lst1[0]
    if ps[3] > g - pt:
        count += math.ceil((g - pt) / ps[2])
        return print(count)
    elif ps[3] == g - pt:
        return print(count + ps[0])
    else:
        print('point :', pt+ps[3], '\ncount :', count+ps[0], '\nremainlst :', lst1[1:])
        calcurate(pt+ps[3], count+ps[0], g, lst1[1:])

calcurate(0,0,g,lst)

import math

d, g = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(d)]

for k,i in enumerate(lst):
    i.append((k+1)*100)
    i.append(i[2]*i[0]+i[1])

def calcurate(pt, count, g, lst):
    lst1 = list()
    for i in lst:
        if i[3] > g - pt:
            lst1.append(i + [i[2]])
        else:
            lst1.append(i + [i[3]/i[0]])
    lst1 = sorted(lst1, key = lambda x: -x[-1])
    ps = lst1[0]
    if ps[3] > g - pt:
        count += math.ceil((g - pt) / ps[2])
        return print(count)
    elif ps[3] == g - pt:
        return print(count + ps[0])
    else:
        calcurate(pt+ps[3], count+ps[0], g, lst1[1:])

calcurate(0,0,g,lst)

d, g = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(d)]

lst1 = list()
for k, pair in enumerate(lst):
    lst1.append([pair[0], pair[1], (k+1)*100, (k+1)*100*pair[0]+pair[1]])
lst = lst1

string = '0' + str(d) + 'b'
str_lst = []
for i in range(0, 2**d):
    str_lst.append(format(i, string))
    
min_count = 10 ** 100
for str1 in str_lst:
    count = 0
    pt = 0
    remain = list()
    for k, qua in enumerate(lst):
        if str1[k] == '1':
            count += qua[0]
            pt += qua[3]
        else:
            remain.append(qua)
    if pt < g:
        qua = remain[-1]
        for i in range(qua[0]-1):
            count += 1
            pt += qua[2]
            if pt >= g:
                break
    if pt >= g:
        if min_count > count:
            min_count = count
            
print(min_count)

Verdicts: Wrong Answer

Wrong Answer

Accepted