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: Time Limit Exceeded

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

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

print(cnt)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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 N>=tmp and (N-tmp)%B==0:
            ans+=1
            
print(ans)

Submission status: Time Limit Exceeded

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

r=n//R
g=n//G
b=n//B

cnt=0
for i in range(r+1):
    for j in range(g+1):
        tmp = i*R + j*G
        if (n-tmp)%B == 0 and 0 <= (n-tmp)//B :
            cnt+=1


print(cnt)

Submission status: Time Limit Exceeded

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

r=n//R
g=n//G
b=n//B

cnt=0
for i in range(r+1):
    for j in range(g+1):
        tmp = i*R + j*G
        if (n-tmp)%B == 0 and 0 <= (n-tmp)//B <= b:
            cnt+=1


print(cnt)

Submission status: Time Limit Exceeded

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

cnt = 0
for i in range(n//r+1):
  for j in range(n//g+1):
    k = (n - i*r - j*g)/b
    if k>=0 and k.is_integer():
      cnt+=1
print(cnt)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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 - r * i - g * j) / b == int((n - r * i - g * j) / b) and (n - r * i - g * j) / b >= 0:
      ans += 1
print(ans)

Submission status: Time Limit Exceeded

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+G*j))>=0 and (N-(R*i+G*j))%B==0:
            count=count+1
print(count)

Submission status: Time Limit Exceeded

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 and (n - (i * r + j * g)) // b >= 0 :
      ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

r,g,b,n = I()
a = []
a.append(r)
a.append(g)
a.append(b)
a.sort()
a[0],a[1],a[2] = r,g,b

mx_b = n//b
amari = n%b
for i in range(n//r + 1):
    for j in range(n//g + 1):
        if (r*i+g*j) % b == amari and (r*i+g*j)//b <= mx_b:
            cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

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 = N - r * R - g * G
        if b < 0 or b % B != 0:
            continue
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys

R, G, B, N = map(int, sys.stdin.readline().split())

r_max = N // R
g_max = N // G

ans = 0
for r in range(r_max+1):
    for g in range(g_max+1):
        res = N - r * R - g * G
        if 0 <= res and res % B == 0:
            # print(r, g, res // B)
            ans += 1

print(ans)

Submission status: Time Limit Exceeded

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):
        if (N - r * R - g * G) % B == 0 and r * R + g * G <= N:
            ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

t = n**0.5

cnt = 0
for i in range(n//r+1):
    for j in range(n//g+1):
        for k in range(n//b+1):
            if i*r + j*g + k*b == n:
                cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

r, g, b, n = inintm()

ans = 0

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

print(ans)

Submission status: Time Limit Exceeded

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

for r in range(3000 + 1):
    if R * r <= N:
        for g in range(3000 + 1):
            v = R * r + G * g
            if N >= v and (N - v) % B == 0:
                ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

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

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
from math import ceil

R, G, B, n = map(int, input().split())
rm = ceil(n / R)
gm = ceil(n / G)
bm = ceil(n / B)
ans = 0
for r in range(rm+1):
    for g in range(gm+1):
        x = n-(r*R+g*G)
        if x >= 0:
            ans += (x%B == 0)

print(ans)

Submission status: Time Limit Exceeded

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
        #print(r,g,b)
        if b>=0:
            if b==int(b):
                cnt+=1

print(cnt)

Submission status: Time Limit Exceeded

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):
        m = r * i + g * j
        if m <= n and (n - m) % b == 0:
            ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
r,g,b,n = map(int, input().split())
ans = 0
rgb = sorted([r,g,b])
n_rgb = []
for e in rgb:
  n_rgb.append(n//e)
for i in range(n_rgb[2]+1):
  for j in range(n_rgb[1]+1):
    N = n - i*rgb[2] - j*rgb[1]
    if  N>=0 and N%rgb[0]==0:
      ans+=1
      
print(ans)

Submission status: Time Limit Exceeded

Solution code:
r, g, b, n = list(map(int, input().split()))

cnt = 0
for i in range(n//r + 1):
    for j in range(n//g + 1):
        nb = (n - (i*r+j*g))/b

        if (nb >= 0) and (nb % 1 == 0):
            cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
r, g, b, n = map(int,input().split())
ans = 0

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
r, g, b, n = map(int,input().split())
ans = 0

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
r, g, b, n = map(int,input().split())
ans = 0

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# 2020/07/26
# diverta 2019 Programming Contest - B

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

ans = 0

# Calc
for ir in range(n+1):
    vr = r * ir 
    if vr > n:
        break

    for ig in range(n+1):
        vg = g * ig 
        if vg > n:
            break
        cb = n - vr - vg
        if cb >= 0 and cb % b == 0:
            ans = ans + 1

# Output
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# 2020/07/26
# diverta 2019 Programming Contest - B

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

ans = 0

# Calc
for ir in range(n+1):
    vr = r * ir 
    if vr > n:
        break

    for ig in range(n+1):
        vg = g * ig 
        if vg > n:
            break
        cb = n - r * ir - vg
        if cb >= 0 and cb % b == 0:
            ans = ans + 1

# Output
print(ans)

Submission status: Time Limit Exceeded

Solution code:
# 2020/07/26
# diverta 2019 Programming Contest - B

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

ans = 0

# Calc
for ir in range(n+1):
    for ig in range(n+1):
        cb = n - r * ir - g * ig
        if cb >= 0 and cb % b == 0:
            ans = ans + 1

# Output
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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 = (N - r*R - g*G)//B
        if r*R + g*G + b*B == N and b >= 0:
            ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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 - (r*i + g*j) >= 0 and (n - (r*i + g*j)) % b == 0: ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from math import ceil
r,g,b,n = map(int, input().split())

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

Submission status: Time Limit Exceeded

Solution code:
X = list(map(int, input().split()))
N = X[-1]
X = X[:3]
X.sort()
N2 = N // X[2]
N1 = N // X[1]
cnt = 0
for i in range(N2 + 1):
    for j in range(N1 + 1):
        if X[2] * i + X[1] * j + X[0] * max(0, (N - X[2] * i - X[1] * j) // X[0]) == N:
            cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

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):
        for b in range((N - r*R - g*G)//B + 1):
            if r*R + g*G + b*B == N:
                ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

ans = [0]*9000000
for r in range(N//R + 1):
    for g in range(N//G + 1):
        for b in range(N//B + 1):
            k = r*R + g*G + b*B
            ans[k] += 1

print(ans[N])

Submission status: Time Limit Exceeded

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):
        for b in range(N//B + 1):
            if r*R + g*G + b*B == N:
                ans += 1 
print(ans)

Submission status: Time Limit Exceeded

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):
    bB=N-r*R-g*G
    if bB >= 0 and bB%B == 0:
      ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
from collections import defaultdict
from collections import deque
import itertools
import copy

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

R,G,B,n = readInts()
ans = 0
for r in range(n//R+2):
	for g in range(n//G+2):
		t = n-(r*R+g*G)
		if t%B==0 and t>=0:
			ans+=1

print(ans)

Submission status: Time Limit Exceeded

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

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy

## input

# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
#    S = []
#    for _ in range(N):
#        S.append(list(input()))

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

ans = 0
tmp1 = N//R + 1

for i in range(tmp1):
    tmp2 = (N - R*i)//G + 1
    for j in range(tmp2):
        tmp3 = (N - R*i - G*j)//B + 1
        for k in range(tmp3):
            if R*i+G*j+B*k == N:
                ans += 1



print(ans)

Submission status: Time Limit Exceeded

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):
    p = N-(r*R+g*G)
    if p%B==0 and p>=0:
      ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
# from pprint import pprint
# import math
# import collections

# n = int(input())
R, G, B, N = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))

max_r, max_g, max_b = N // R, N // G, N // B
ans = []

r, g, b = 0, 0, 0
cnt = 0
for r in range(3000):
    if R * r > N:
        break

    max_g = (N - R * r) // G

    for g in range(max_g + 1):
        if R * r + G * g > N:
            break
        x = (N - (R * r + G * g))
        if x % B == 0 and x >= 0:
            b = x // B
            a = (r, g, b)
            cnt += 1
            # ans.append(a)

# print(len(ans))
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
# from pprint import pprint
# import math
# import collections

# n = int(input())
R, G, B, N = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))

max_r, max_g, max_b = N // R, N // G, N // B
ans = []

r, g, b = 0, 0, 0
cnt = 0
for r in range(max_r + 1):
    if R * r > N:
        break
    for g in range(max_g + 1):
        if R * r + G * g > N:
            break
        x = (N - (R * r + G * g))
        if x % B == 0 and x >= 0:
            b = x // B
            a = (r, g, b)
            cnt += 1
            # ans.append(a)

# print(len(ans))
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
# from pprint import pprint
# import math
# import collections

# n = int(input())
R, G, B, N = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))

max_r, max_g, max_b = N // R, N // G, N // B
ans = []

r, g, b = 0, 0, 0
for r in range(max_r + 1):
    if R * r > N:
        break
    for g in range(max_g + 1):
        if R * r + G * g > N:
            break
        x = (N - (R * r + G * g))
        if x % B == 0 and x >= 0:
            b = x // B
            a = (r, g, b)

            ans.append(a)

print(len(ans))

Submission status: Time Limit Exceeded

Solution code:
# from pprint import pprint
# import math
# import collections

# n = int(input())
R, G, B, N = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))

max_r, max_g, max_b = N // R, N // G, N // B
ans = []

r, g, b = 0, 0, 0
for r in range(max_r + 1):
    for g in range(max_g + 1):
        if R * r + G * g > N:
            break
        x = (N - (R * r + G * g))
        if x % B == 0 and x >= 0:
            b = x // B
            a = (r, g, b)

            ans.append(a)

print(len(ans))

Submission status: Time Limit Exceeded

Solution code:
# from pprint import pprint
# import math
# import collections

# n = int(input())
R, G, B, N = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))

max_r, max_g, max_b = N // R, N // G, N // B
ans = []

r, g, b = 0, 0, 0
for r in range(max_r + 1):
    for g in range(max_g + 1):
        x = (N - (R * r + G * g))
        if x % B == 0 and x >= 0:
            b = x // B
            a = (r, g, b)

            ans.append(a)

print(len(ans))

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N = map(int,input().split())
cnt = 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 :
            cnt +=1
            #print(r,g,(N - r*R - g*G)//B)
print(cnt)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

rr=n//r+1
gg=n//g+1
bb=n//b+1
ans=0
for i in range(rr):
  for j in range(gg):
    for k in range(bb):
      if i*r+j*g+k*b==n:
        ans+=1
print(ans)

Submission status: Time Limit Exceeded

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):
        check = (N - (R*r + G*g))/B
        if float.is_integer(check) and check >= 0:
            ans += 1
        # if check >= 0 and check%B == 0:
            # ans += 1
        # if check == 0:
        #     # print(r, g, check//B, check)
        #     ans += 1
        # elif check > 0 and check%B == 0:
        #         # print(r, g, check//B, check)
        #         ans += 1

print(ans)

Submission status: Time Limit Exceeded

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):
        check = N - (R*r + G*g)
        if check >= 0 and check%B == 0:
            ans += 1
        # if check == 0:
        #     # print(r, g, check//B, check)
        #     ans += 1
        # elif check > 0 and check%B == 0:
        #         # print(r, g, check//B, check)
        #         ans += 1

print(ans)

Submission status: Time Limit Exceeded

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):
        check = N - (R*r + G*g)
        if check == 0:
            # print(r, g, check//B, check)
            ans += 1
        elif check > 0 and check%B == 0:
                # print(r, g, check//B, check)
                ans += 1

print(ans)

Submission status: Time Limit Exceeded

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):
        check = N - (R*r + G*g)
        if check == 0:
            # print(r, g, check//B, check)
            ans += 1
        elif check > 0:
            if check%B == 0:
                # print(r, g, check//B, check)
                ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N = map(int,input().split())
c = sorted([R,G,B])
R = c[1]
G = c[2]
B = c[0]
ans = 0
for r in range(N//R+1):
    tmp = N - r*R
    for g in range(N//G+1):
        ttmp = tmp - g*G
        ans += int(ttmp%B == 0 and ttmp >= 0)
print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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 = N - r*R - g*G
        if tmp >= 0 and tmp%B == 0:
            ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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 0 <= n-r*i-g*j and (n-r*i-g*j)%b == 0:
            ans += 1

print(ans)

Submission status: Time Limit Exceeded

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 0 <= n-r*i-g*j:
            if (n-r*i-g*j)%b == 0:
                ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

count = 0

for r in range(3001):
    for g in range(3001):
        redball = r*R
        greenball = g*G
        tempbull = N - (redball + greenball)
        
        if (redball >= 0) and (greenball >= 0) and (tempbull >= 0):
            if (redball + greenball + tempbull == N) and (tempbull % B == 0):
                count = count + 1

print(count)

Submission status: Time Limit Exceeded

Solution code:
import itertools
R,G,B,n = map(int, input().split())
ans = 0
for r in range(n//R+1):
    if R*r > n: break
    for g in range(n//G+1):
        ball = R*r + G*g
        if ball > n or (n-ball)%B!=0: continue
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

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):
        ball = R*r + G*g
        if ball > n or (n-ball)%B!=0: continue
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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):
        temp = n-r*i-g*j
        if temp>=0 and temp%b==0: ans+=1
print(ans)

Submission status: Time Limit Exceeded

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):
        if (N - r*R - g*G) % B == 0 and (N - r*R - g*G) >= 0:
            ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

cnt =0
    
for r in range(N+1):
    
    for g in range(N+1-r*R):
        
        ball =  r*R+g*G  
        
        res = N-ball
        
        if  res >=0  and res%B ==0:
            cnt+=1
    
print(cnt)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

cnt =0
    
for r in range(N+1):
    
    for g in range(N+1):
        
        ball =  r*R+g*G  
        
        res = N-ball
        
        if  res >=0  and res%B ==0:
            cnt+=1
    
print(cnt)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
R,G,B,N = map(int, input().split())
index = 0
ans = 0
for_sort = [R,G,B]
for_sort.sort()
r = for_sort[2]
g = for_sort[1]
b = for_sort[0]
while N >= r*index:
  middle = N - r*index
  index += 1
  index2 = 0
  while middle >= g*index2:
    end = middle - g*index2
    index2 += 1
    if end % b == 0:
      ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
R, G, B, n = map(int, input().split())
ans = 0
r = 0
while r*R <= n:
    g = 0
    while r*R + g*G <= n:
        b = (n - r*R - g*G) // B
        if (r*R + g*G + b*B == n) and (b >= 0):
            ans += 1
        g += 1
    r += 1
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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)>=0 and (n-i*r-j*g)%b==0:
      ans=ans+1
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

cnt = 0
for r in range(N//R + 1):
    for b in range(N//B + 1):
        res = (N - r*R - b*B)
        if res >= 0 and res%G == 0:
            cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

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


cnt=0
for i in range(n+1):
    for j in range(n+1):

        hB = n - (r*i) - (j*g)

        if hB >= 0 and hB%b==0:
            cnt+=1

print(cnt)

Submission status: Time Limit Exceeded

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

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


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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):
        num=(n-(i*r+j*g))%b
        if num==0 and n-(i*r+j*g)>=0:
            ans+=1
print(ans)

Submission status: Time Limit Exceeded

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