Problem:


Score : 200 points

Problem Statement

Snuke has come to a store that sells boxes containing balls. The store sells the following three kinds of boxes:

Red boxes, each containing R red balls

Green boxes, each containing G green balls

Blue boxes, each containing B blue balls

Snuke wants to get a total of exactly N balls by buying r red boxes, g green boxes and b blue boxes.
How many triples of non-negative integers (r,g,b) achieve this?

Constraints

All values in input are integers.

1 \leq R,G,B,N \leq 3000

Input

Input is given from Standard Input in the following format:

R G B N

Output

Print the answer.

Sample Input 1

1 2 3 4

Sample Output 1

4

Four triples achieve the objective, as follows:

(4,0,0)

(2,1,0)

(1,0,1)

(0,2,0)

Sample Input 2

13 1 4 3000

Sample Output 2

87058



Sample input:
1 2 3 4


Sample output:
4

Submission status: Accepted

Solution code:
def main():

    R, G, B, N = map(int, input().split())

    ans = 0

    for i in range((N//R)+1):
        r = i
        for j in range(((N-R*r)//G)+1):
            g = j
            if (N-R*r-G*g) % B == 0 and N-R*r-G*g >= 0:
                ans += 1

    print(ans)

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
r, g, b, n = map(int, input().split())
count = 0
for i in range(n//r + 1):
  for j in range((n-r*i) // g + 1):
    d = n - r*i - g*j
    if d%b == 0:
      count += 1
print(count)

Submission status: Accepted

Solution code:
r, g, b, n = map(int, input().split())
count = 0
for i in range(n//r + 1):
  for j in range((n-r*i) // g + 1):
    d = n - r*i - g*j
    if d%b == 0 and d >= 0:
      count += 1
print(count)

Submission status: Accepted

Solution code:
# 2019/10/17

R,G,B,n=map(int,input().split())
cnt=0
for i in range(n//R+1):
    r=i*R
    rem=n-r
    for j in range((n-r)//G+1):
        g=j*G
        b=n-(r+g)
        if b%B:continue
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
r,g,b,n = map(int,input().split())
cnt=0
s=[r,g,b]
s.sort()
for i in range(n//s[2]+1):
    if i*s[2]==n:
        cnt+=1
    else:
        for j in range((n-i*s[2])//s[1]+1):
            if n-i*s[2]==s[1]*j:
                cnt+=1
            else:
                if (n-i*s[2]-j*s[1]) % s[0] ==0:
                    cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
*j, N = map(int,input().split())
j.sort()
a,b,c = j
cnt = 0
for r in range(N//b+1):
    for g in range((N-b*r)//c+1):
        v = b*r+c*g
        if (N-v)%a == 0:
            cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
def resolve():
    R, G, B, n = map(int, input().split())
    ans = 0
    for r in range(n + 1):
        for g in range(n + 1):
            b = n - r * R - g * G
            if b >= 0 and b % B == 0:
                ans += 1
    print(ans)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
R,G,B,N = map(int,input().split())
ans = 0
for r in range(N//R + 1):
  for g in range(N//G + 1):
    b = max(0, (N - r*R - g*G) // B)
    if r*R + g*G + b*B == N:
      ans += 1
print(ans)

Submission status: Accepted

Solution code:
R, G, B, N = tuple(map(int, input().split()))
ans = 0
for i in range(N//R+1):
    for j in range(N//G+1):
        rest = (N - R * i - G * j)
        if rest < 0:
            break
        if rest % B == 0:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
r, g, b, n = map(int, input().split())
ans = 0
for i in range(n//r+2):
    flag = False
    for j in range(n//g+2):
        tmp = n - (r*i + g*j)
        if tmp < 0:
            break 
        if tmp % b == 0:
            ans += 1

print(ans)

Submission status: Accepted

Solution code:
R,G,B,N=map(int,input().split())
c=0
for i in range(N//R+1):
  for j in range((N-R*i)//G+1):
    if (N-R*i-G*j)%B==0:
      c+=1
print(c)

Submission status: Accepted

Solution code:
R,G,B,N=map(int,input().split())

ans=0
for r in range(N//R+1):
  for g in range((N-r*R)//G+1):
    if (N-r*R-g*G)%B==0:
      ans+=1
print(ans)

Submission status: Accepted

Solution code:
R,G,B,N=map(int, input().split())
count=0
for r in range(N//R+1):
    for g in range((N-R*r)//G+1):
        if (N-R*r-G*g)%B==0:
            count+=1
print(count)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())
R, G, B = sorted([R, G, B], reverse=True)
if B == 1:
  c = 0
  for r in range(0, N+1):
    if r*R > N:
      break
    n = N-r*R
    c += 1+n//G
  print(c)
  exit()
c = 0
for r in range(0, N+1):
  if r*R > N:
    break
  for g in range(0, N+1):
    if r*R+g*G > N:
      break
    n = N-r*R-g*G
    if n%B == 0:
      c += 1
print(c)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
r, g, b, n = map(int, input().split())
ans = 0
for i in range(n + 1):
    for j in range(n + 1):
        k = (n - i * r - j * g) // b
        if k < 0:
            continue
        if i * r + j * g + k * b == n:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
r,g,b,n = map(int, input().split())
count = 0
c0,c1,c2 = sorted([r,g,b])
for i in range(1+n//c2):
    rest1 = n - i*c2
    if rest1 < 0:
        break
    for j in range(1+rest1//c1):
        rest = n - i*c2 - j*c1
        if rest <0:
            break
        elif rest%c0 == 0:
            count += 1
print(count)

Submission status: Accepted

Solution code:
r, g, b, n = [int(num) for num in input().split()]
arr = [r, g, b]
arr.sort()

#総当たり
counter = 0
for c_1 in range(0, n // arr[-1] + 1):
  for c_2 in range(0, n // arr[-2] + 1):
      if n - c_1 * arr[-1] - c_2 * arr[-2] < 0:
        break
      if (n - c_1 * arr[-1] - c_2 * arr[-2]) % arr[-3] == 0:
        counter += 1
print(counter)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())
ans = 0

for r in range(N // R + 1):
    for g in range((N - (r * R)) // G + 1):
        if (N - (r * R) - (g * G)) % B == 0:
            ans += 1

print(ans)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())

ans = 0
for i in range(int(N / R) + 1):
    for j in range(int((N - i * R) / G) + 1):
        if (N - (i * R + j * G)) % B == 0:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())

ans = 0
for i in range(int(N / R) + 1):
    for j in range(int((N - i * R) / G) + 1):
        if ((N - (i * R + j * G)) % B == 0):
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
R,G,B,n=map(int,input().split())
i=0
ans=0
for i in range(int(n/R)+1):
  for j in range(int((n-i*R)/G)+1):
    if((n-R*i-G*j)%B==0):
      ans+=1

print(ans)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())

ans = 0
for i in range(N//R+1):
  cntR = N - i * R
  for j in range(cntR//G+1):
    cntG = cntR - j * G
    if cntG % B == 0:
      ans += 1
print(ans)

Submission status: Accepted

Solution code:
r, g, b, n = [ int(v) for v in input().split() ]
r, g, b = sorted([r, g, b],reverse = True)

ans = 0
for i in range((n+r)//r):
    n1 = n - r * i
    for j in range((n1+g)//g):
        n2 = n1 - g * j
        if n2 % b == 0:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())

ans = 0
for r in range(N+1):
    for g in range((N-r*R)//G+1):
        b0 = N-r*R-g*G
        if b0 % B == 0:
            ans += 1

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#diverta2019 B

import sys
import math
import bisect
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7

r,g,b,n = map(int,input().split())

ans = 0
for i in range(n//r+1):
    for j in range(n//g+1):
        if n - i*r - j*g >= 0:
            if (n - i*r - j*g) % b == 0:
                ans += 1
print(ans)

Submission status: Accepted

Solution code:
R, G, B, N = map(int,input().split())

ans = 0
for i in range(N//R+1):
    for j in range((N- R*i)//G+1):
        if (N -R*i -G*j) % B == 0:
            ans += 1

print(ans)

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-

def solve():
    R, G, B, N = list(map(int, input().split()))

    ans = 0
    for r in range(N+1):
        if r*R > N: break
        
        for g in range(N+1):
            if r*R+g*G > N: break
            
            if (N - (r*R+g*G))%B == 0:
                ans += 1
    print(ans)

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
r, g, b, n = [int(i) for i in input().split()]
cnt = 0
for i in range(n//r+1):
    for j in range((n-i*r)//g+1):
        if (n-i*r-j*g) %b == 0:
            cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
R,G,B,N = map(int,input().split())
ans = 0
for r in range(N//R +1):
    for g in range((N-R * r)//G +1):
        if (N -R * r -G * g) % B == 0:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
R,G,B,N=map(int,input().split())

#R*r+G*g+B*b==n
ir=int(N/R)+1
ig=int(N/G)+1
ib=int(N/B)+1
s=0
for r in range(ir):
    for g in range(ig):
        if(R*r+G*g>N):
            break;
        if((N-R*r-G*g)%B==0):
            s+=1
print(s)

Submission status: Accepted

Solution code:
r, g, b, n = map(int,input().split())
res = 0
for i in range(n // r + 1):
    for j in range((n-r*i) // g + 1):
        if (n - (i * r) - (g * j) ) % b == 0:
            #print("{0}, {1}, {2}".format(i, j, (n - (i * r) - (g * j) ) % g))
            res += 1

print(res)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())
cnt = 0
rindex = 0
while R * rindex <= N:
	gindex = 0
	while R * rindex + G * gindex <= N:
		if (N - R * rindex - G * gindex) % B == 0:
			cnt += 1
		gindex += 1
	rindex += 1
print(cnt)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())
ans = 0
for r in range(N // R + 1):
    N1 = N - r*R
    for g in range(N1 // G + 1):
        N2 = N1 - g*G
        if N2 % B == 0: ans += 1
print(ans)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())

cnt = 0
for r in range(N+1):
    for g in range(N+1):
        b = (N-r*R-g*G)/B
        if b >= 0 and b.is_integer():
            cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())
ans = 0

for r in range(N//R+1):
    tmp = N - r * R
    for g in range(tmp//G+1):
        if (N - r * R - g * G) % B == 0:
            ans += 1

print(ans)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())
ball = 0
count = 0
num = N//R
for i in range(num+1):
    ball = N-(i*R)
    num2 = ball//G
    for j in range(num2+1):
        n2 = ball-(j*G)
        if n2%B == 0 or n2 == 0:
            count +=1
        else:
            continue
print(count)

Submission status: Accepted

Solution code:
#n = int(input())
#m = int(input())
#k = int(input())
#n, m = map(int, input().split())
r, g, b, n = map(int, input().split())
#a = list(map(int, input().split()))
#table = []
'''
for i in range h:
    temp = list(map(int, input().split()))
    table.append(temp)
'''
count = 0
for i in range(n//r+1):
    for j in range((n-r*i)//g+1):
        if (n-r*i-g*j)%b == 0:
            count +=1
print(count)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())

ans = 0

for r in range(N+1):
  if r*R > N:
    break
  for g in range(N+1):
    rg = r*R + g*G
    if rg > N:
      break
    if (N - rg)%B == 0 :
      ans += 1
      
print(ans)

Submission status: Accepted

Solution code:
R, G, B, N = list(map(int, input().split()))
m = 0
NN = N
for r in range(N//R + 1) :
  if r != 0 :
    NN -= R
  for g in range(NN//G + 1) :
    if g == 0 :
      NNN = NN
    else :
      NNN -= G
    if NNN%B == 0 :
      m += 1

print(m)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(R: int, G: int, B: int, N: int):
    
    res = 0
    for r in range(N+1): 
        if r*R > N:
            break
        for g in range(N+1): 
            rgcnt = r*R + g*G 
            if rgcnt > N:
                break
            if (N-rgcnt) % B == 0:
                res += 1

    print(res)

    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    R = int(next(tokens))  # type: int
    G = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(R, G, B, N)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n,k = LI()
    print(n-k+1)
    return

#B
def B():
    r,g,b,n = LI()
    ans = 0
    for i in range(n+1):
        x = r*i
        for j in range(n+1-x):
            y = g*j
            z = n-x-y
            if z%b != 0 or z < 0:continue
            ans += 1
    print(ans)
    return

#C
def C():
    n = I()

    return

#D
def D():
    n = I()

    return

#E
def E():
    n = I()

    return

#F
def F():
    n = I()

    return

#G
def G():
    n = I()

    return

#H
def H():
    n = I()

    return

#I
def I_():
    n = I()

    return

#J
def J():
    n = I()

    return

#Solve
if __name__ == "__main__":
    B()

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())

RGB = sorted([R, G, B], reverse=True)
max1 = N // RGB[0] 

count = 0
for r in range(max1+1):
    max2 = min([N-r, (N-r*RGB[0])//RGB[1]])
    for g in range(max2+1):
        if (N - (r*RGB[0] + g*RGB[1])) % RGB[2] == 0:
            count += 1
print(count)

Submission status: Accepted

Solution code:
a,b,c,n=map(int,input().split())
d=[a,b,c]
d.sort()
a=d[0]
b=d[1]
c=d[2]
e=0
for i in range(0,n//c+1):
    for k in range(0,(n-c*i)//b+1):
        if ((n-c*i-b*k)%a)==0:
            e=e+1
print(e)

Submission status: Accepted

Solution code:
R,G,B,N=map(int,input().split())

tmp=0
for i in range(N//R+1):
  for j in range((N-R*i)//G+1):
    if (N-(R*i+G*j))%B==0:
      tmp+=1
print(tmp)

Submission status: Accepted

Solution code:
R,G,B,N = list(map(int,input().split(' ')))

count = 0

r_max = N // R
for r in range(0,r_max+1):
	N_N = N - R * r
	g_max = N_N//G+1
	for g in range(0,g_max):
		if (N-r*R - g*G)%B == 0:
			count += 1

print(count)

Submission status: Accepted

Solution code:
R,G,B,N = map(int,input().split())
ans = 0
for r in range(N//R+1):
    for g in range((N-R*r)//G+1):
        if (N-R*r-G*g)%B == 0:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
R,G,B,N = map(int,input().split())
cnt = 0
for r in range(N//R+1):
  for g in range((N-R*r)//G+1):
    if (N-R*r-G*g)%B == 0:
      cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())
 
ans = 0
for r in range(N//R+1):
  for g in range(N//G+1):
    tmp = r*R+g*G
    if  tmp <= N and (N-tmp) % B == 0:
      ans += 1
print(ans)

Submission status: Accepted

Solution code:
r, g, b, n = map(int, input().split())
a = [0] * (n + 1)
a[0] = 1
for i in [r, g, b]:
    for j in range(n + 1 - i):
        a[i + j] += a[j]
print(a[n])

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())

count = 0
while N >= 0 :
    N_2 = N
    while N_2 >= 0:
        if N_2 % B == 0:
            count += 1
        N_2 -= G
    N -= R

print(count)

Submission status: Accepted

Solution code:
a,b,c,n = tuple(int(x) for x in raw_input().split(' '))

ans = 0
for i in xrange(0, n/a+1):
  for j in xrange(0, n/b+1):
    k = (n - i*a - j*b)/c
    #print i,j,k,i*a+j*b+k*c
    if i*a+j*b+k*c == n and k >= 0:
      ans += 1
print ans

Submission status: Accepted

Solution code:
R,G,B,N=map(int,input().split())
a=[0]*(N+1)
a[0]=1

for i in [R,G,B]:
    for j in range(N+1-i):
        a[j+i]+=a[j]
 
print(a[N])

Submission status: Accepted

Solution code:
R,G,B,N=map(int,input().split())
counter=0
 
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        b=(N-r*R-g*G)/B
        if b.is_integer() and b>=0:
            counter += 1
 
print(counter)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())
cnt = 0
for i in range(N//R + 1):
    for j in range((N-R*i)//G + 1):
        if (N - R*i - G*j) % B == 0:
            cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
r,g,b,n=map(int,input().split())
ans=0
for i in range(3001):
    for j in range(3001):   
        if (n-r*i-g*j)>=0 and (n-r*i-g*j)%b==0:
                ans+=1
print(ans)

Submission status: Accepted

Solution code:
r,g,b,n = map(int,input().split())
count = 0
lis = [r,g,b]
lis.sort()
r = lis[0]
g = lis[1]
b = lis[2]
for i in range((n//b)+1):
    cn = n - b*i
    for j in range((cn//g)+1):
        cn2 = cn - g*j
        if cn2%r == 0:
            count += 1
print(count)

Submission status: Accepted

Solution code:
*j, n = map(int, input().split())
j.sort()
a, b, c = j
count = 0
for y in range(n//b+1):
    for z in range((n-y*b)//c+1):
        if (n - b*y - c*z) % a == 0:
            count += 1
print(count)

Submission status: Accepted

Solution code:
r, g, b, n = [int(i) for i in input().split()]
total = 0
rm = n//r
for rn in range(rm + 1):
	gm = (n - rn * r) // g
	for gn in range(gm + 1):
		bd = n - r * rn - g * gn
		if bd % b == 0:
			total += 1
print(total)

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    R, G, B, N = map(int, input().split())

    ans = 0
    for r in range(N // R + 10):
        for g in range(N // G + 10):
            rest = N - R * r - G * g
            if rest < 0 or rest % B != 0:
                continue
            ans += 1
    
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
###template###
import sys
input = sys.stdin.readline
def mi(): return map(int, input().split())
###template###

Rt, Gt, Bt, N = mi()

R = max(Rt, Gt, Bt)
B = min(Rt, Gt, Bt)
G = Rt+Gt+Bt-R-B

cnt = 0

for i in range(N//R+1):
  for j in range((N-R*i)//G+1):
    #残り必要ボール数
    if (N - R*i - G*j)%B == 0:
      cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
###template###
import sys
input = sys.stdin.readline
def mi(): return map(int, input().split())
###template###

Rt, Gt, Bt, N = mi()

R = max(Rt, Gt, Bt)
B = min(Rt, Gt, Bt)
G = Rt+Gt+Bt-R-B

cnt = 0
if G == 1 and B == 1:
  for i in range(N//R+1):
    cnt += (N-R*i)+1
  print(cnt)
  exit()

for i in range(N//R+1):
  for j in range((N-R*i)//G+1):
    #残り必要ボール数
    if (N - R*i - G*j)%B == 0:
      cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())
ans = 0
for r in range(0, N+1, R):
    for g in range(0, N-r+1, G):
        if (N - r - g) % B == 0:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())
ans = 0
for r in range(N+1):
    for g in range(N+1):
        s = N - R*r - G*g
        if s >= 0 and s % B == 0:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys,random
try: sys.stdin = open('in.in','r')
except: pass

R,G,B,N = map(int,input().split())

ans = 0
for r in range(0,N+1,R):
	for b in range(0,N+1-r,B):
		if (N-b-r)%G != 0: continue
		ans += 1
print(ans)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())

ret = 0

for r in range(N + 1):
    for g in range(N - r + 1):
        bB = (N - R * r - G * g)
        if bB >= 0 and bB % B == 0:
            ret += 1

print(ret)

Submission status: Accepted

Solution code:
r,g,b,n = map(int,input().split())
 
ans = 0
for i in range(n//r+1):
    for j in range((n-r*i)//g+1):
        if (n-r*i-g*j)%b == 0:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
import numpy as np

r,g,b,n=map(int,input().split())

x = np.arange(3001)
t = np.array([np.arange(0,3001*g,g)]*3001).T
y = np.array([x]*3001)
z = y*r+t
print(np.sum(np.logical_and((n-z)%b==0,n-z>=0)))

Submission status: Accepted

Solution code:
import numpy as np

r,g,b,n=map(int,input().split())

x = np.arange(3001)
rr=x*r
f=0
for i in range(3002):
    p = ((n-rr)%b==0)
    q = n-rr>=0
    f+=np.sum(np.logical_and(p,q))
    rr+=g
print(f)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())
ans = 0
for i in range(N // R + 1):
    left = N - i * R
    for j in range(left // G + 1):
        if (left - j * G) % B == 0:
            ans += 1

print(ans)

Submission status: Accepted

Solution code:
R, G, B, N = list(map(int, input().split()))
cnt = 0
for r in range(N//R + 1):
    for g in range((N - r*R)//G + 1):
        if (N-r*R-g*G) % B == 0:
            cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
B - RGB Boxes
https://atcoder.jp/contests/diverta2019/tasks/diverta2019_b

"""
import sys


def solve(R, G, B, N):
    ans = 0
    for r in range(N//R+1):
        for g in range(N//G+1):
            t = N - r*R - g*G
            if t < 0:
                break
            if t % B == 0:
                ans += 1
    return ans


def main(args):
    R, G, B, N = map(int, input().split())
    ans = solve(R, G, B, N)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
# -*- coding:utf-8 -*-
r,g,b,n=map(int,input().split(" "))
count=0
r1=n//r
for i in range(0,r1+1):
    g1=(n-i*r)//g+1
    for j in range(0,g1):
        if (n-i*r-j*g)%b==0:
            count=count+1
print(count)

Submission status: Accepted

Solution code:
#coding:utf-8

R, G, B, N = map(int, input().split())

cnt = 0

for red in range(int(N/R)+1):
    for green in range(int((N-red*R)/G)+1):
        if (N - (red*R + green*G)) % B == 0:
            cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
import numpy as np
I=lambda:map(int,input().split())
R,G,B,N=I()
bB=N-np.arange(0,N+1,R)-np.arange(0,N+1,G).reshape(-1,1)
print(np.sum((bB>=0)&(bB%B==0)))

Submission status: Accepted

Solution code:
r, b, g, n = [int(x) for x in input().rstrip().split(" ")]

total = 0

for current_1 in range(0, n + 1, r):
  for current_2 in range(current_1, n + 1, b):
    if (n - current_2) % g == 0:
      total += 1

print(total)

Submission status: Accepted

Solution code:
def combinations(R, G, B, N):
    R, G, B, N = int(R), int(G), int(B), int(N)
    sorted_tuple = sorted((R, G, B), reverse=True)
    R = sorted_tuple[0]
    G = sorted_tuple[1]
    B = sorted_tuple[2]
    number_combos = 0

    for x in range(N // R + 1):
        for y in range((N - R * x) // G + 1):
            if (N - R * x - G * y) % B == 0:
                number_combos += 1
        
    return number_combos

R, G, B, N = input().split(' ')
print(combinations(R, G, B, N))

Submission status: Accepted

Solution code:
R,G,B,N = map(int,input().split())
total = 0
for r in range(N // R + 1):
	for g in range((N - R * r) // G + 1):
		if (N - R * r - G * g) % B == 0:
			total += 1
print(total)

Submission status: Accepted

Solution code:
R, G, B, N = [int(i) for i in input().split()]
dp = [0] * (N + 1)
dp[0] = 1
for c in (R, G, B):
    for i in range(N + 1 - c):
        dp[i + c] += dp[i]
print(dp[N])

Submission status: Accepted

Solution code:
r,g,b,n =map(int,input().split())
ans = 0
for i in range((n//r)+1):
  for l in range(((n-i*r)//g)+1):
    if (n-i*r-l*g)%b == 0:
      ans += 1

print(ans)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())

ans = 0
for r in range(N // R + 1):
    for g in range((N - (R * r)) // G + 1):
        if(N - (R * r) - (G * g)) % B == 0:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
R,G,B,N = map(int,input().split())

ans_count = 0

for red in range(int(N/R)+1):
  for green in range(int((N-red*R)/G)+1):
    if (N - red*R - green*G) % B ==0 :
      ans_count += 1

print(ans_count)

Submission status: Accepted

Solution code:
R,G,B,n=map(int,input().split())
sum_rg=[0 for i in range(n+1)]
for r in range(n+1):
	for g in range(n+1):
		tmp=R*r+G*g
		if tmp>n:
			break
		else:
			#print(f'Bb:{n-tmp}')
			sum_rg[n-tmp]+=1
#print(sum_rg)
count=0
for i in range(n//B+1):
	count+=sum_rg[i*B]
print(count)

Submission status: Accepted

Solution code:
r, g, b, n = map(int, input().split())
count = 0
for i in range(n // r + 1):
    for j in range(n // g + 1):
        if (n - r * i - j * g) % b == 0 and (n - r * i - j * g) >= 0:
            count += 1
print(count)

Submission status: Accepted

Solution code:
R,G,B,N = map(int,input().split())
cnt = 0
for r in range((N // R) + 1):
    for g in range((N - (r * R)) // G + 1):
        V = N - (r * R + g * G)
        if V >= 0 and V % B == 0:
            cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
from sys import exit

R, G, B, N = map(int, input().split())

count = 0

for r in range(N // R + 1):
	for g in range((N - r * R) // G + 1):
		if (N - r * R - g * G) % B == 0:
			count += 1

print(count)

Submission status: Accepted

Solution code:
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
def ddprint(x):
  if DBG:
    print(x)

cnt = 0
r,g,b,n = inm()
for i in range(n//r+2):
  for j in range((n-i*r)//g+2):
      rest = n-i*r-j*g
      if rest >= 0 and rest%b == 0:
          cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, raw_input().strip().split())

ans = 0
for r in xrange(N + 1):
    for g in xrange(N + 1):
        cur = R * r + G * g
        if cur > N: break
        rem = N - cur
        if rem % B != 0: continue
        b = rem // B
        ans += 1

print ans

Submission status: Accepted

Solution code:
R, G, B, N = map(int,input().split())
 
i = 0
j = 0
cnt = 0
 
while i*R <= N:
    while i*R + j*G <= N:
        temp = N - i*R - j*G
        if temp % B == 0:
            cnt += 1
        j += 1
    j = 0
    i += 1
 
print(cnt)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())
 
count = 0
tmp1 = N + R
for i in range(N // R + 1):
    tmp1 -= R
    tmp2 = tmp1 + G
    for j in range(N // G + 1):
        tmp2 -= G
        if tmp2 < 0:
            continue
        if tmp2 % B == 0:
            count += 1
 
print(count)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())

count = 0
tmp1 = N + R
for i in range(N // R + 1):
    tmp1 -= R
    tmp2 = tmp1 + G
    for j in range(N // G + 1):
        tmp2 -= G
        if tmp2 < 0:
            continue
        if tmp2 % B == 0:
            count += 1

print(count)

Submission status: Accepted

Solution code:
r,g,b,n = map(int, input().split())
ans = 0
for i in range(n // r + 1):
  res = n - r * i
  for j in range(res // g + 1): 
    res2 = res - g * j
    if not (res2 % b):
      ans += 1
print(ans)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split(" "))

ans=0

for count_r in range(N // R + 1):
    currnt_N = N - R * count_r
    for count_g in range(currnt_N // G + 1):
        #pass
        currnt_N = N - R * count_r - G * count_g
        if currnt_N % B == 0:
            ans += 1
            
print(ans)

Submission status: Accepted

Solution code:
R,G,B,N=list(map(int,input().split()))
ans=0
if 1<=R<=3000 and 1<=G<=3000 and 1<=B<=3000 and 1<=N<=3000:
	limR=N//R
	for r in range(limR+1)[::-1]:
		zanGB=N-r*R
		limG=zanGB//G
		for g in range(limG+1):
			zanB=zanGB-g*G
			if zanB%B==0:
				b=zanB//B
				ans+=1
print(ans)

Submission status: Accepted

Solution code:
r,g,b,n=map(int,input().split())
ans=0
for i in range(n//r+1):
    for j in range(n//g+1):
        if (n-(i*r+j*g))%b==0:
            if 0<=n-i*r-j*g:
                ans+=1
print(ans)

Submission status: Accepted

Solution code:
import math
input = input().split()
r = int(input[0])
g = int(input[1])
b = int(input[2])
N = int(input[3])
 
count = 0
# print(N/r)
# print(math.ceil(N/r))
for x in range(math.ceil(N/r+0.0001)):
    for y in range(math.ceil((N-x*r)/g + 0.0001)):
        # print(str(x), str(y))
        if  (N - x*r - y*g) % b == 0:
            count +=1
 
print(count)

Submission status: Accepted

Solution code:
R,G,B,n=[int(x) for x in input().split()]
ans=0
for r in range(n//R+1):
    for g in range(n//G+1):
        if n-r*R-g*G>=0 and (n-r*R-g*G)%B==0:
            ans+=1
print(ans)

Submission status: Accepted

Solution code:
r,g,b,n=list(map(int,input().split()))
i,j=0,0
R,G=0,0
c=0
while R<=n:
    while G<=n-R:
        if (n-R-G)%b==0:
            c+=1
        G+=g
    G=0
    R+=r

print(c)

Submission status: Accepted

Solution code:
R, G, B, N = list(map(int, input().split()))

cnt = 0
for r in range(N//R + 1):
    for g in range((N - r*R)//G + 1):
        if (N-r*R-g*G) % B == 0:
            cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
'''input
13 1 4 3000
'''

R, G, B, N=map(int, input().split())

count=0
for r in range(N//R+1):
	for g in range((N-R*r)//G+1):
		# b=
		if (N-R*r-G*g)%B==0: 
			# print(r, g, b)
			count+=1

print(count)

Submission status: Accepted

Solution code:
R, G, B, N = map(int,input().split())
ans = 0
for r in range(N//R + 1):
  for g in range((N - r*R)//G + 1):
    if (N - r*R - g*G) % B == 0:
      ans += 1
print(ans)

Submission status: Accepted

Solution code:
R, G, B, N = map(int, input().split())

ans = 0
for r in range(N//R + 1):
    for g in range((N - (R*r))//G + 1):
        if(N - (R*r) - (G*g)) % B == 0:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
R, G, B, N = list(map(int, input().split()))

ans = 0
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        if (N-r*R-g*G) % B == 0:
            ans += 1
print(ans)