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: Wrong Answer

Solution code:
r,g,b,n=map(int,input().split())
def INT(m):
  if int(m)==m:
    return True
  return False
aa=[r,g,b]
aa.sort()
a,b,c=aa[0],aa[1],aa[2]
ans=0
for i in range(n//c):
  for j in range((n-i*c)//b):
    if INT((n-i*c-j*b)/a):
      ans+=1
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 S(): return input().rstrip()
def LS(): return S().split()
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():
    R, G, B, n = LI()
    ans = 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 r * R + g * G + b * B == n:
                ans += 1
    print(ans)
    return


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

RL=(N+R-1)//R

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

print(cnt)

Submission status: Wrong Answer

Solution code:
r,g,b,n = map(int,input().split())
count = 0
box = [r,g,b]
box.sort()
for i in range(n):
    for j in range(n):
        for k in range(n):
            if((box[0]*i + box[1]*j + box[2]*k) == n):
                count += 1
                break
            if(box[2]*k > n):
                break
        if(box[1]*j > n):
            break
    if(box[0]*i > n):
        break
print(count)

Submission status: Wrong Answer

Solution code:
r,g,b,n = map(int,input().split())
count = 0
box = [r,g,b]
box.sort()
for i in range(n):
    for j in range(n):
        for k in range(n):
            if((box[0]*i + box[1]*j + box[2]*k) == n):
                count += 1
                break
            if(box[0]*k > n):
                break
        if(box[1]*j > n):
            break
    if(box[2]*i > n):
        break
print(count)

Submission status: Wrong Answer

Solution code:
r,g,b,n = map(int, input().split())
res = 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 or n - i * r - j * g == n:
      res = res + 1
print(res)

Submission status: Wrong Answer

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

a = [R, G, B]
a.sort()

x = N // a[2]
ans = 0
for i in range(x+1):
    n = N - (i * a[2])
    y = n // a[1]
    for j in range(y+1):
        if (n - a[1] * i) % a[0] == 0:
            ans += 1
print(ans)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# ALC007 C

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

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

print(count)

Submission status: Wrong Answer

Solution code:
# ALC007 C

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

for i in range(n+1):
    numBall = i * r
    if numBall > n:
        break
    elif numBall == n:
        count += 1
        break
    for j in range(n+1):
        numBall = i * r + j * g
        if numBall > n:
            break
        elif numBall == n:
            count += 1
            break
        else:
            if (n - numBall) % b == 0:
                count += 1
                break


print(count)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
r,g,b,n = [int(i) for i in input().split()]
ans = 0
 
for i in range(3000):
    for j in range(3000):
        total = i * r + j * g
        if n - total < 0:
            break
        elif (n - total) % b == 0:
            ans += 1
 
print(ans)

Submission status: Wrong Answer

Solution code:
r,g,b,n = sorted([int(i) for i in input().split()])
ans = 0
 
for i in range(0,n+1,r):
    for j in range(0,n+1,g):
        total = i + j
        if n - total < 0:
            break
        elif (n - total) % b == 0:
            ans += 1
 
print(ans)

Submission status: Wrong Answer

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

B,G,R = sorted([R,G,B])

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

Submission status: Wrong Answer

Solution code:
import itertools
r,g,b,n=map(int,input().split())
r,g,b=list(range(r+1)),list(range(g+1)),list(range(b+1))
count = 0
for i,j,k in itertools.product(r,g,b):
  s = i + j + k
  if s==n:
    count+=1
print(count)

Submission status: Wrong Answer

Solution code:
r,g,b,n = sorted([int(i) for i in input().split()])
ans = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
l = sorted([int(i) for i in input().split()])
ans = 0

for i in range(l[3] // l[2] + 1):
    for j in range(l[3] // l[1] + 1):
        if (l[3] - i * l[2] - j * l[1]) % l[0] == 0 and (l[3] - i * l[2] - j * l[1]) >= 0:
            ans += 1
            
print(ans)

Submission status: Wrong Answer

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

#%%
count = 0
ans = 0
for r in range(0, N+1, R):
    for g in range(0, N+1-r, G):
        rg = r + g
        if rg == 3000 or (3000 - rg) % B == 0:
            ans += 1
            count = 0
            
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import numpy as np

stdin = sys.stdin
 
ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

R, G, B, N = rl()
UP = 3000
A = np.zeros(UP+1, dtype=np.int32)

for r in range(UP):
    if r * R > UP:
        continue
    A[r*R::G] += 1

answer = A[N::-B].sum()
print(answer)
#08

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
r,g,b,n = [int(i) for i in input().split()]
ans = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
r,g,b,n = [int(i) for i in input().split()]
ans = 0

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

print(ans)

Submission status: Wrong Answer

Solution code:
from sys import stdin
R, G, B, N = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 0
for i in range(3000):
  for j in range(3000):
    tmp = i*R+j*G
    if N >= tmp and (N-tmp)%B == 0:
      ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

#+++++
		
def main():
	R,G,B,N = map(int, input().split())
	cc=0
	ri=0
	while ri * R <= N:
		ri+=1
		gi=0
		while G*gi + ri*R <= N:
			gi+=1
			nn=N-(G*gi+R*ri)
			if nn % B == 0:
				cc+=1
			gi+=1
		ri+=1
	
	print(cc)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Wrong Answer

Solution code:
import sys

#+++++
		
def main():
	R,G,B,N = map(int, input().split())
	cc=0
	ri=-1
	while ri * R <= N:
		ri+=1
		gi=-1
		while G*gi + ri*R <= N:
			gi+=1
			nn=N-(G*gi+R*ri)
			if nn % B == 0:
				cc+=1
	
	print(cc)
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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:
            print(r,g,(N - (R*r) - (G*g)))
            ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

rr=n//r
gg=n//g
tmp=0
A=0
B=0
for i in range(rr+1):
    for j in range(gg+1):
        B=n-r*i+g*j
        if(((B%b)==0)):
            tmp+=1
print(tmp)

Submission status: Wrong Answer

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

rr=n//r
gg=n//g
tmp=0
A=0
B=0
for i in range(rr+1):
    for j in range(gg+1):
        if(((B%b)==0)&((B/b)<3001)):
            tmp+=1
print(tmp)

Submission status: Wrong Answer

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


tmp=0

for i in range(3000):
    if(r*i>3000):break
    for j in range(3000):
        if(r*i+g*j>3000):break
        if((n-r*i-g*j)<0):break
        if((((n-r*i-g*j)%b)==0)&(((n-r*i-g*j)/b)<3000)):
            tmp+=1
print(tmp)

Submission status: Wrong Answer

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


tmp=0

for i in range(3000):
    if(r*i>3000):break
    for j in range(3000):
        if(r*i+g*j>3000):break
        if((n-r*i-g*j)<0):break
        if((((n-r*i-g*j)%b)==0)&(((n-r*i-g*j)/b)<3000)):
            print(i,j,((n-r*i-g*j)/b))
            tmp+=1
print(tmp)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 0
for i in range(R):
  cntR = N - i
  for j in range(min(cntR, G)):
    cntG = cntR - j
    if cntG <= B:
      ans += 1
print(ans)

Submission status: Wrong Answer

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: Wrong Answer

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

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

Submission status: Wrong Answer

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
            break;
print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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,int(n/c)+1):
  f=n-c*i
  for k in range(0,int(f/b)+1):
    g=f-b*k
    if g/a-int(g/a)==0:
      print(g,k,i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
R,G,B,N = map(int,input().split())
ans = 0
RGB = sorted([R,G,B],reverse=True)
R,G,B = RGB[0],RGB[1],RGB[2]
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: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(counter)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
r, g, b, n = [int(i) for i in input().split()]
total = 0

rm = n//r
for i in range(rm + 1):
	gm = n - i * r // g
	for j in range(gm + 1):
		bd = n - r * i - g * j
		if bd % b == 0:
			total += 1
print(total)

Submission status: Wrong Answer

Solution code:
r, g, b, n = [int(i) for i in input().split()]
total = 0

rm = n//r
for i in range(rm + 1):
	gm = n - i * r
	for j in range(gm + 1):
		bd = n - r * i - g * j
		if bd % b == 0:
			total += 1
print(total)

Submission status: Wrong Answer

Solution code:
r,g,b,n=map(int,input().split())
ans=0
ir=0
ig=0
ib=0
li=[]
li.append(r)
li.append(g)
li.append(b)
li.sort(reverse=True)
r=li[0]
g=li[1]
b=li[2]

while n>=ir*r:

    if g!=1:

            while n>=ig*g:
                    if (n - (ir * r + ig * g)) / b >= 0:
                        if (n - (ir * r + ig * g)) % b == 0:
                            ans = ans + 1
                    ig = ig + 1
            ig = 0
            ir = ir + 1
    else:
            ans=int(ans+(n-ir*r))

            ig=0
            ir=ir+1


print(ans)

Submission status: Wrong Answer

Solution code:
r,g,b,n=map(int,input().split())
ans=0
ir=0
ig=0
ib=0
li=[]
li.append(r)
li.append(g)
li.append(b)
li.sort()
r=li[0]
g=li[1]
b=li[2]

while n>=ir*r:

    if g!=1:

            while n>=ig*g:
                    if (n - (ir * r + ig * g)) / b >= 0:
                        if (n - (ir * r + ig * g)) % b == 0:
                            ans = ans + 1
                    ig = ig + 1
            ig = 0
            ir = ir + 1
    else:
            ans=int(ans+(n*(n+1)/2))

            ig=0
            ir=ir+10000


print(ans)

Submission status: Wrong Answer

Solution code:
r,g,b,n=map(int,input().split())
ans=0
ir=0
ig=0
ib=0
li=[]
li.append(r)
li.append(g)
li.append(b)
li.sort()
r=li[0]
g=li[1]
b=li[2]

while n>=ir*r:



            while n>=ig*g:
                if g==1:
                    i=ig=n
                    if (n - (ir * r + ig * g)) / b >= 0:
                        if (n-(ir*r+ig*g))%b==0:

                             ans=ans+n
                else:
                    i = ig = n
                    if (n - (ir * r + ig * g)) / b >= 0:
                        if (n - (ir * r + ig * g)) % b == 0:
                            ans = ans + 1
                    ig = ig + 1
            ir = n
            ig=0
            ans=ans*n



print(ans)

Submission status: Wrong Answer

Solution code:
r,g,b,n=map(int,input().split())
ans=0
ir=0
ig=0
ib=0
li=[]
li.append(r)
li.append(g)
li.append(b)
li.sort()
r=li[0]
g=li[1]
b=li[2]

while n>=ir*r:

        if r<n:


            while n>=ig*g:
                if g==1:
                    i=ig=n
                    if (n - (ir * r + ig * g)) / b >= 0:
                        if (n-(ir*r+ig*g))%b==0:

                             ans=ans+n
                else:
                    i = ig = n
                    if (n - (ir * r + ig * g)) / b >= 0:
                        if (n - (ir * r + ig * g)) % b == 0:
                            ans = ans + 1
                    ig = ig + 1
            ir = n
            ig=0
            ans=ans*n

        else:
            break

print(ans)

Submission status: Wrong Answer

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

rb = n // r + 1 
gb = n // b + 1 
bb = n // b + 1 

ans = 0 

for i in range(rb):
  for j in range(gb):
    for k in range(bb):
      a = (r * i) + (g * j) + (k * b)
      if a == n:
        ans += 1 
      elif a > n:
        break
      else:
        pass

print(ans)

Submission status: Wrong Answer

Solution code:
r,g,b,n=map(int,input().split())
ans=0
ir=0
ig=0
ib=0
li=[]
li.append(r)
li.append(g)
li.append(b)
li.sort(reverse=True)
r=li[0]
g=li[1]
b=li[2]

while n>=ir*r:
        if r == 1:


            while n>=ig*g:
                if (n - (ir * r + ig * g)) / b >= 0:
                    if (n-(ir*r+ig*g))%b==0:

                         ans=ans+1
                ig = ig + 1
            ir = ir + 1
            ig=0
            ans=ans*n
            ir=10000000
        else:
            while n >= ig * g:
                if (n - (ir * r + ig * g)) / b >= 0:
                    if (n - (ir * r + ig * g)) % b == 0:
                        ans = ans + 1
                ig = ig + 1
            ir = ir + 1
            ig = 0

print(ans)

Submission status: Wrong Answer

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('ok')
  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: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(count)

Submission status: Wrong Answer

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

print(count)

Submission status: Wrong Answer

Solution code:
R,G,B,n=map(int,input().split())
sum_rg=[]
for r in range(n+1):
	for g in range(n-1):
		Rr,Gg=R*r,G*g
		if Rr<n or Gg<n:
			break
		else:
			sum_rg.append(n-Rr-Gg)
count=0
for i in sum_rg:
	if not i%B:
		count+=1
print(count)

Submission status: Wrong Answer

Solution code:
R,G,B,n=map(int,input().split())
sum_rg=[]
for r in range(n+1):
	for g in range(n-1):
		Rr,Gg=R*r,G*g
		if Rr>n or Gg>n:
			break
		else:
			sum_rg.append(n-Rr-Gg)
count=0
for i in sum_rg:
	if not i%B:
		count+=1
print(count)

Submission status: Wrong Answer

Solution code:
R,G,B,n=map(int,input().split())
sum_rg=[]
for r in range(n+1):
	for g in range(n-1):
		tmp=n-R*r-G*g
		if tmp<0:
			break
		else:
			sum_rg.append(tmp)
count=0
for i in sum_rg:
	if not i%B:
		count+=1
print(count)

Submission status: Wrong Answer

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

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

print(count)

Submission status: Wrong Answer

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
        j+=1
        G=g*j
    i+=1
    G,j=0,0
    R=r*i

print(c)

Submission status: Wrong Answer

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

print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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

ans = 0
for r in range(min(R+1, N+1)):
    for g in range(min(G+1, N-r+1)):
        if N-r-g <= B:
            ans += 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def c2(a, b, c):
    r = 0
    for i in range(0, c):
        y = c - (a * i)
        if y < 0:
            break

        if y % b == 0:
            r += 1

    return r

A = sorted([R,G,B], reverse=True)

ans = 0
for i in range(0, N//A[0] + 1):
    qq = c2(A[1], A[2], N-(A[0]*i))
    ans += qq

if N % A[0] == 0:
    ans += 1

print(ans)

Submission status: Wrong Answer

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

def c2(a, b, c):
    r = 0
    for i in range(0, c):
        y = c - (a * i)
        if y < 0:
            break

        if y % b == 0:
            r += 1

    return r

A = sorted([R,G,B], reverse=True)

ans = 0
for i in range(0, N//A[0] + 1):
    qq = c2(A[1], A[2], N-(A[0]*i))
    ans += qq

print(ans)

Submission status: Wrong Answer

Solution code:
R, G , B, N = map(int, input().split())
cnt = 0
flag = False
for i in range(3001):
    if i*R > N:
        break
    for j in range(3001):
        if i*R + j*G > N:
            flag = True
            break
        if i*R+j*G <= N and (N-i*R-j*G) % B == 0:
            cnt += 1
    if flag:
        break
print(cnt)

Submission status: Wrong Answer

Solution code:
read = input
A = list(map(int, read().split()))
n = A[-1]
A = A[:3]
A.sort(reverse=True) # descending
ans = 0
if A[1] == A[2]:# deal with 1 1
    for i in range(n+1):
        tmp = i*A[0]
        if tmp > n:break
        ans += (n-tmp) - 0 + 1
else :
    for i in range(n+1):
        for j in range(n+1):
            tmp = i * A[0] + j * A[1]
            if tmp > n:break
            tmp = n - tmp
            if tmp % A[2] == 0:
    #             print(i, j, tmp//A[2])
                ans += 1
print(ans)

Submission status: Wrong Answer

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

cnt = 0 

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

print(cnt)