Problem:


Score : 700 points

Problem Statement

N people are waiting in a single line in front of the Takahashi Store. The cash on hand of the i-th person from the front of the line is a positive integer A_i.

Mr. Takahashi, the shop owner, has decided on the following scheme: He picks a product, sets a positive integer P indicating its price, and shows this product to customers in order, starting from the front of the line. This step is repeated as described below.

At each step, when a product is shown to a customer, if price P is equal to or less than the cash held by that customer at the time, the customer buys the product and Mr. Takahashi ends the current step. That is, the cash held by the first customer in line with cash equal to or greater than P decreases by P, and the next step begins.

Mr. Takahashi can set the value of positive integer P independently at each step.

He would like to sell as many products as possible. However, if a customer were to end up with 0 cash on hand after a purchase, that person would not have the fare to go home. Customers not being able to go home would be a problem for Mr. Takahashi, so he does not want anyone to end up with 0 cash.

Help out Mr. Takahashi by writing a program that determines the maximum number of products he can sell, when the initial cash in possession of each customer is given.

Constraints

1 ≦ | N | ≦ 100000

1 ≦ A_i ≦ 10^9(1 ≦ i ≦ N)

All inputs are integers.

Input

Inputs are provided from Standard Inputs in the following form.

N
A_1
:
A_N

Output

Output an integer representing the maximum number of products Mr. Takahashi can sell.

Sample Input 1

3
3
2
5

Sample Output 1

3

As values of P, select in order 1, 4, 1.

Sample Input 2

15
3
1
4
1
5
9
2
6
5
3
5
8
9
7
9

Sample Output 2

18



Sample input:
3
3
2
5


Sample output:
3

Submission status: Wrong Answer

Solution code:
n = int(input())
curr_max = 0
ans = 0
for i in range(n):
    a = int(input())
    if i == 0:
        ans += (a-1)
        curr_max = 1
    else:
        step = curr_max + 1
        if a > step: 
            diff = a - 1
            ans += diff//step
        else:
            curr_max = a

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

n = int(input())
a = [None]*n
for i in range(n):
    a[i] = int(input())
ans = a[0]-1
prev = 1
for i,num in enumerate(a[1:]):
    if prev+1<num:
        while num-(prev+1)>0:
            v = (num-1)//(prev+1)
            num -= v*(prev+1)
            ans += 1
            if num==prev+1:
                num = prev
                break
    prev = max(prev, num)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    N = int(input())
    #N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    A = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    cur=1
    ans=0
    for a in A:
        if a==cur:
            cur+=1
            continue
        d,x=divmod(a,cur)
        if x==0:
            a-=cur+1
            ans+=a//cur+1
        else:
            ans+=d

    print(ans)


        
        




if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    N = int(input())
    #N, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    A = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列
    cur=1
    ans=0
    for a in A:
        d,x=divmod(a,cur)
        if x==0:
            cur+=1
            ans+=max(0,d-1)
        else:
            ans+=d

    print(ans)


        
        




if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
*A, = [int(input()) for _ in range(N)]

ans = 0
v = 0

for i, j in enumerate(A):
    if j==v+1:
        v += 1
    ans += (j-1)//(v+1)

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
*A, = [int(input()) for _ in range(N)]

ans = 0
v = 1

for i, j in enumerate(A):
    if i==0:
        ans += j-1
    else:
        if j==v+1:
            v += 1

        if j%(v+1):
            ans += j//(v+1)
        else:
            ans += j//(v+2)

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(input()) for _ in range(n)]

ans = 0
tmp = 1
for i in range(n):
    if a[i] <= tmp:
        tmp = max(tmp, a[i] + 1)
        continue

    ans += -(-(a[i] - tmp) // tmp)
    a[i] = a[i] + (-(a[i] - tmp) // tmp) * tmp
    a[i] = 1

print(ans)

Submission status: Wrong Answer

Solution code:
#greedy customers
N=int(input())
ans=0
d=[int(input()) for _ in range(N)]
if d[0]>1:
    ans+=d[0]-1
d[0]=1
now=2
for i in range(1,N):
    if d[i]==now:
        now+=1
    else:
        #d[i]!=now:
        if d[i]<now:
            pass
        elif d[i]>now:
            if d[i]%now==0:
                K=d[i]//now
                if K==2:
                    ans+=1
                    d[i]=1
                elif K>2:
                    ans+=K-2
                    d[i]=1                
            elif d[i]%now!=0:
                u,v=divmod(d[i],now)
                ans+=u
                d[i]=v
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

N = int(input())
A = [int(input()) for _ in range(N)]
ans = A[0] - 1
P = 2
for i in range(1, N):
    if A[i] == P:
        P += 1
        continue
    q = (A[i] - 1) // P
    if A[i] == (q + 1) * P:
        q = (A[i] - 1) // (P + 1)
    ans += q
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [ int(input()) for _ in range(N) ]

ans =  0
m = 0
for i,a in enumerate(A):
  if a == m+1:
    m = m + 1
  else:
    ans += (a - 1) // (m+1)
  if i == 0:
    m += 1
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [ int(input()) for _ in range(N) ]

ans =  0
m = 0
for a in A:
  if a == m+1:
    m = m + 1
  else:
    ans += (a - 1) // (m+1)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for i in range(N)]
now = 2
count = A[0]-1
for i in range(1,N):
    if A[i] == now:
        now += 1
    elif A[i]%now != 0:
        count += A[i]//now
    else:
        count += (A[i]-1)//(now+1)
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for i in range(N)]
now = 2
count = A[0]-1
for i in range(1,N):
    if A[i] == now:
        now += 1
    elif A[i]%now != 0:
        count += A[i]//now
    else:
        count += A[i]//(now+1)
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for i in range(N)]
now = 2
count = A[0]-1
for i in range(1,N):
    if A[i] == now:
        now += 1
    elif A[i]%now != 0:
        count += A[i]//now
    else:
        for j in range(now+1,10**9+1):
            if 0 < A[i]%j <= now:
                count += A[i]//j
                break
        if A[i]%j == now:
            now += 1
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for i in range(N)]
now = 2
count = A[0]-1
for i in range(1,N):
    if A[i] == now:
        now += 1
    elif A[i]%now:
        count += A[i]//now
    else:
        count += A[i]//(now+1)
        if A[i]%(now+1) == now:
            now += 1
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for i in range(N)]
now = 2
count = A[0]-1
maxrem = 1
for i in range(1,N):
    if A[i] == now:
        now += 1
    elif A[i]%now:
        count += A[i]//(now+1)
    else:
        count += A[i]//now
print(count)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = [int(input()) for i in range(n)]
cnt = 2
ans = a[0]-1
for i in range(1,n):
  if a[i] == cnt+1:
    cnt += 1
  else:
    ans += (a[i]-1)//cnt
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = [int(input()) for i in range(n)]
cnt = 1
ans = 0
for i in range(n):
  if a[i] == cnt+1:
    cnt += 1
  else:
    ans += (a[i]-1)//cnt
    if cnt == 1:
      cnt += 1
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    A = [int(input()) for i in range(N)]
    mi = 1
    ans = A[0] - 1
    for a in A[1:]:
        if a <= mi + 1:
            mi = max(mi, a)
            continue
        if a % (mi + 1) == 0:
            ans += a // (mi + 2)
        else:
            ans += a // (mi + 1)
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict as dd
input = sys.stdin.readline
N = int(input())
a = []
for _ in range(N): a.append(int(input()))
res = a[0] - 1
a[0] = 1
mx = 1
mxa = max(a)
for i in range(N - 1):
  mx = max(mx, a[i])
  t = (a[i + 1] - 1) // (mx + 1)
  ok = mx + 1
  ng = mxa
  while ng - ok > 1:
    m = (ok + ng) // 2
    if (a[i + 1] - 1) // m == t: ok = m
    else: ng = m
  a[i + 1] %= ok
  res += t
  #print(res, mx)
print(res)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
mx = 1
a = []
for _ in range(N): a.append(int(input()))
res = a[0] - 1
a[0] = 1
for i in range(1, N):
  ok = mx + 1
  ng = a[i]
  ch = (a[i] - 1) // (mx + 1)
  while ng - ok > 1:
    m = (ok + ng) // 2
    if (a[i] - 1) // m == ch:
      ok = m
    else: ng = m
  res += (a[i] - 1) // ok
  a[i] -= ((a[i] - 1) // ok) * ok
  mx = max(mx, a[i])
  #print(res, mx, a)
print(res)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):

    ans = 0
    b = 0
    for a in A:
        p = b + 1
        c = (a-1) // p
        ans += c
        if c == 0:
            b = a
        if b == 0:
            b = 1
        # print(a, b, c, ans)

    return ans


def main():
    N = read_int()
    A = [read_int() for _ in range(N)]
    print(slv(N, A))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):

    ans = 0
    b = 0
    for a in A:
        p = b + 1
        c = (a-1) // p
        ans += c
        if c == 0:
            b = a
        if b == 0:
            b = 1
        print(a, b, c, ans)

    return ans


def main():
    N = read_int()
    A = [read_int() for _ in range(N)]
    print(slv(N, A))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
for i in range(n):
    a0 = int(input())
    a.append(a0)
ans = 0
key = "b"
count = 1
m = 0
for i in range(n):
    if key == "a":
        if a[i] == count:
            count += 1
        elif a[i] > count:
            if a[i]%count == 0:
                if a[i]//count == 2:
                    ans += 1
                else:
                    ans += a[i]//count - 1
                    count += 1
            else:
                if a[i]//count == 1:
                    ans += 1
                else:
                    ans += a[i]//count
    else:
        if i == 0:
            ans += a[i]-1
            count += 1
        else:
            if a[i] == 2:
                key = "a"
                count = 3
                m = 2
            else:
                if a[i]%2 == 0:
                    ans += a[i]//2-1
                else:
                    ans += a[i]//2
    #print(ans,count)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
for i in range(n):
    a0 = int(input())
    a.append(a0)
ans = 0
key = "b"
count = 1
m = 0
for i in range(n):
    if key == "a":
        if a[i] == count:
            count += 1
            m = max(m,a[i])
        elif a[i] > count:
            if a[i]%count == 0:
                if a[i]//count == 2:
                    ans += 1
                else:
                    ans += a[i]//count - 1
                    count += 1
                    m = max(m,count-1)
            else:
                if a[i]//count == 1:
                    ans += 1
                else:
                    ans += a[i]//count
                    m = max(m,a[i]%count)
                    count = m+1
    else:
        if i == 0:
            ans += a[i]-1
            count += 1
        else:
            if a[i] == 2:
                key = "a"
                count = 3
                m = 2
            else:
                if a[i]%2 == 0:
                    ans += a[i]//2-1
                else:
                    ans += a[i]//2
    #print(ans,count)
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def LS(): return list(map(list, input().split()))
def S(): return list(input().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    ans = 0
    pre = 1
    for _ in range(II()):
        a = II()
        if pre > a:
            continue
        if a % pre:
            ans += a // pre
            continue
        if pre == a:
            pre += 1
            continue
        tmp = a // pre - 1
        ans += tmp
    print(ans)

    return


#main
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for i in range(N)]

ans = 0
X = 0

for a in A:
    # 一つも売れない
    if a - 1 < X + 1:
        X = max(X, a)
        continue

    sell = (a - 1) // (X + 1)
    ans += sell

    next_X_1 = a - ((X + 1) * sell)

    p = (X + 1) + ((a - 1) % (X + 1)) // sell
    next_X_2 = a - (p * sell)

    X = max(X, min(next_X_1, next_X_2))

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for i in range(N)]

ans = 0
X = 0

for a in A:
    # 一つも売れない
    if a - 1 < X + 1:
        X = max(X, a)
        continue

    sell = (a - 1) // (X + 1)
    ans += sell
    next_X_1 = a - ((X + 1) * sell)
    p = X + ((a - 1) % (X + 1) + 1) // sell
    next_X_2 = a - (p * sell)

    X = max(X, min(next_X_1, next_X_2))

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for i in range(N)]

ans = 0
X = 0


for a in A:
    # 一つも売れない
    if a - 1 < X + 1:
        X = max(X, a)
        continue

    sell = (a - 1) // (X + 1)
    ans += sell
    next_X_1 = a % ((X + 1) * sell)
    p = X + (a % (X + 1)) // sell
    if p:
        next_X_2 = a % p
    else:
        next_X_2 = float('inf')
    X = max(X, min(next_X_1, next_X_2))

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for i in range(N)]

ans = 0
X = 0


for a in A:
    # 一つも売れない
    if a - 1 < X + 1:
        X = max(X, a)
        continue

    sell = (a - 1) // (X + 1)
    ans += sell
    next_X_1 = a % ((X + 1) * sell)
    p = X + ((a - 1) % (X + 1)) // sell
    if p:
        next_X_2 = a % p
    else:
        next_X_2 = float('inf')
    X = max(X, min(next_X_1, next_X_2))

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for i in range(N)]

ans = 0
X = 0


for a in A:
    # 一つも売れない
    if a - 1 < X + 1:
        X = max(X, a)
        continue

    sell = (a - 1) // (X + 1)
    ans += sell
    next_X = a % ((X + 1) * sell)
    X = max(X, next_X)

print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[int(input()) for i in range(N)]
x,r=0,0
for a in A:
    d=(a-1)//(x+1)
    if d==0:
        x=a
    elif x==0:
        x=1
    r+=d
print(r)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for _ in range(N)]
#%%
last_n = 1
cnt = 0
for ind,a in enumerate(A):
    if(a==last_n):
        last_n += 1
        continue

    if(ind==0):
        n = a-1
        last_n += 1
    elif(a%last_n==0):
        n = a//(last_n+1)
    else:
        n = a//last_n
    cnt += n
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for _ in range(N)]
#%%
last_n = 1
cnt = 0
for ind,a in enumerate(A):
    if(ind!=0 and a==last_n):
        last_n += 1

    if(ind==0):
        n = a-1
        after = 1
        last_n += 1
    elif(a%last_n==0):
        n = a//(last_n+1)
        after = a-n*(last_n+1)
    else:
        n = a//last_n
        after = a-n*last_n
    cnt += n
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for _ in range(N)]
#%%
last_n = 1
cnt = 0
for ind,a in enumerate(A):
    if(ind!=0 and a==last_n):
        last_n += 1

    if(ind==0):
        n = a-1
        after = 1
        last_n += 1
    elif(a%last_n==0):
        n = (a-1)//(last_n+1)
        after = a-n*(last_n+1)
    else:
        n = (a-1)//last_n
        after = a-n*last_n
    if(after == last_n):
        last_n += 1
    cnt += n
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for _ in range(N)]
#%%
last_n = 1
cnt = 0
for ind,a in enumerate(A):
    if(ind!=0 and a==last_n):
        last_n += 1

    if(ind==0):
        n = a-1
        after = 1
        last_n += 1
    elif(a%last_n==0):
        n = (a-1)//(last_n+1)
        after = a-n*(last_n+1)
    else:
        n = (a-1)//last_n
        after = a-n*last_n
    cnt += n
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for _ in range(N)]
#%%
last_n = 1
cnt = 0
for ind,a in enumerate(A):
    if(ind!=0 and a==last_n):
        last_n += 1

    if(ind==0):
        n = a-1
        after = 1
    elif(a%last_n==0):
        n = (a-1)//(last_n+1)
        after = a-n*(last_n+1)
    else:
        n = (a-1)//last_n
        after = a-n*last_n
    cnt += n
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for _ in range(N)]
#%%
last = 1
cnt = 0
for ind,a in enumerate(A):

    if(ind==0):
        n = a-1
        after = 1
    elif(a%last==0):
        n = (a-1)//(last+1)
        after = a-n*(last+1)
    else:
        n = (a-1)//last
        after = a-n*last
    if(after==last):
        last += 1
    cnt += n
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for _ in range(N)]
#%%
last = 1
cnt = 0
for ind,a in enumerate(A):

    if(ind==0):
        n = a-1
        after = 1
        last += 1
    elif(a%last==0):
        n = (a-1)//(last+1)
        after = a-n*(last+1)
    else:
        n = (a-1)//last
        after = a-n*last
    if(after==last):
        last += 1
    cnt += n
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for _ in range(N)]
#%%
last = 1
cnt = 0
for ind,a in enumerate(A):

    if(ind==0):
        n = a-1
        after = 1
        last += 1
    elif(a%last==0):
        n = (a-1)//(last+1)
        after = a-n*(last+1)
    else:
        n = (a-1)//last
        after = a-n*last
    if(a==last):
        last += 1
    cnt += n
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [int(input()) for _ in range(N)]
#%%
last_max = 0
cnt = 0
for ind,a in enumerate(A):
    if(ind==0):
        n = a-1
        after = 1
    elif(a%(last_max+1)==0):
        n = (a-1)//(last_max+2)
        after = a-n*(last_max+2)
    else:
        n = (a-1)//(last_max+1)
        after = a-n*(last_max+1)
    last_max = max(last_max,after)
    cnt += n
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [0] * N
Z = 0
cnt = 0
for i in range(N):
  a = int(input())
  if a > Z + 1:
    z = (a - 1) // (Z + 1)
    cnt += z
  else:
    Z = max(a, Z)
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [0] * N
Z = 0
cnt = 0
for i in range(N):
  a = int(input())
  z = (a - 1) // (Z + 1)
  cnt += z
  if z: a = (a - 1) % z + 1
  Z = max(a, Z)
print(cnt)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [0] * N
Z = 0
cnt = 0
for i in range(N):
  a = int(input())
  z = (a - 1) // (Z + 1)
  cnt += z
  if z: a %= z
  Z = max(a, Z)
print(cnt)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=[int(input()) for _ in range(N)]
max_rem=0
ans=0
for a in A:
    if a >= max_rem+2:
        h = max_rem+1
        c,rem = divmod(a-1, h)
        max_rem = max(max_rem, rem)
        ans += c
    else:
        max_rem = max(max_rem, a)
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[int(input())for i in range(n)]
c=0
b=1
d=0
while c<n:
    if a[c]==b:
        b+=1
        c+=1
    else:
        if a[c]%b==0:
            d+=max((a[c]-2-b)//b+1,a[c]//b-1)
            c+=1
        else:
            d+=a[c]//b
            c+=1
print(d)

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline
n=int(input())
A=[int(input()) for _ in range(n)]
ans=A[0]-1
cnt=2
for i,a in enumerate(A[1:]):
    if a<=cnt:
        continue
    if a==cnt+1:
        cnt+=1
        continue
    while a>cnt:
        if a%cnt:
            a-=cnt+1
            ans+=1
        else:
            a-=cnt
            ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(input()) for i in range(n)]
a = a[::-1]

ans = 0
num = 1

while a:
    if a[-1] == num:
        num += 1
    elif a[-1] > num:
        if a[-1] % num == 0:
            a[-1] = a[-1] - (num + 1)
            ans += 1
            ans +=  a[-1] // num
        else:
            ans += a[-1] // num
    del a[-1]

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

bottom = 1
res = 0

for i in range(n):

    if a[i] == bottom: bottom=a[i]+1
    b = (a[i] - 1) // bottom
    res += b
    if i ==0:bottom+=1

print(res)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

bottom = 1
res = 0

for i in range(n):
    b = (a[i]-1)//bottom
    if b == 0 and a[i] >= bottom:bottom=a[i]+1
    res += b
    if i ==0:bottom+=1

print(res)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

n = int(input())
arr = []
for i in range(n):
    arr.append(int(input()))
count = max(arr[0]-1,0)
index = 2
for a in arr:
    if a > index:
        count += (a - 1) // index
    if a == index:
        index += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
count = max(a[0]-1,0)
index = 2
for i in range(1,n):
    if a[i] > index:
        count += (a[i] - 1) / index
    if a[i] == index:
        index += 1
print(count)

Submission status: Wrong Answer

Solution code:
n = int(raw_input())

ls = []
for i in range(n):
    ls.append(int(raw_input()))


min = 1
cnt = 0

for i in ls:
    # print ls, cnt, min
    if i > min:
        if i % min is 0:
            temp = i / min
            cnt += temp - 1
            if min is 1:
                min += 1
        else:
            temp = i / min
            cnt += temp
    elif i is min:
        min += 1

#output
print cnt

Submission status: Wrong Answer

Solution code:
n = int(raw_input())

ls = []
for i in range(n):
    ls.append(int(raw_input()))


min = 1
cnt = 0
running = True
while ls:
    # print ls, cnt, min
    i = ls[0]
    if i > min:
        if i % min is 0:
            temp = i / min
            cnt += temp - 1
            if min is 1:
                min += 1
        else:
            temp = i / min
            cnt += temp
    if i is min:
        min += 1
    ls = ls[1:]

#output
print cnt

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
for i in range(N):
	A.append(int(input()))
c = 0
sold = 0
i = 0
while i<len(A):
	if A[i] == c+1:
		i+=1
		c+=1
		#print('1 Ai: ',A[i-1],'c->',c,'i->',i)
	elif A[i]<=2*(c+1) and A[i]>=c+1:
		i+=1
		sold+=1
		#print('2 Ai-> ',A[i-1],'i->',i, 's->',sold)
	elif A[i]>2*(c+1) and A[i]>=c+1:
		#print('3 Ai-> ',A[i-1], 's->',sold, 'sell ',((A[i]-1)//(c+1)))
		sold+=((A[i]-1)//(c+1))
		i+=1
	else:
		i+=1
		#print('4 Ai: ',A[i-1], 'i->',i)
print(sold)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
for i in range(N):
	A.append(int(input()))
print(N)
print(A)
print(A[0])
c = 0
sold = 0
i = 0
while i<len(A):
	if A[i] == c+1:
		i+=1
		c+=1
		#print('1 Ai: ',A[i-1],'c->',c,'i->',i)
	elif A[i]<=2*(c+1) and A[i]>=c+1:
		A[i]-=(A[i]-1)
		i+=1
		sold+=1
		#print('2 Ai-> ',A[i-1],'i->',i, 's->',sold)
	elif A[i]>2*(c+1) and A[i]>=c+1:
		A[i] -= c+1
		sold+=1
		#print('3 Ai-> ',A[i], 's->',sold)
	else:
		i+=1
		#print('4 Ai: ',A[i-1], 'i->',i)
print(sold)

Submission status: Wrong Answer

Solution code:
N = int(raw_input())
costs = []
for x in range(N):
    costs.append(int(raw_input()))
mini = 1
n = 0
sold = 0
while n < N:
    if costs[n] <= mini:
        mini = max(mini, costs[n] + 1)
        n += 1
    else:
        new = costs[n] - mini
        if mini > 1 and new == mini:
            costs[n] = new - 1
            n += 1
        else:
            costs[n] = new
            sold += 1
print sold