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())

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

Submission status: Wrong Answer

Solution code:
R, G, B, N = map(int,input().split())
R, G, B = sorted([R, G, B])
cnt = 0
for i in range(N+1):
  for j in range(N+1):
    k = N - G*i - B*j
    if k >= 0:
      if G*i + B*j + R*k == N:
        cnt += 1
    else:
      break
print(cnt)

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
b = sorted(a)
num = b[3] // b[2]
count = 0
for i in range(num+1):
  c = b[3] - (b[2] * i)
  num1 = c // b[1]
  if num1 >= 1:
    for j in range(num1+1):
      d = c - (b[1] * j)
      num3 = d / b[0]
      if num3.is_integer() is True:
        count += 1
  else:
    num2 = c // b[0]
    if num2 >= 1:
      count += 1
print(count)

Submission status: Wrong Answer

Solution code:
r,g,b,n = map(int,input().split())
w_r = int(n/r)
w_g = int(n/g)
w_b = int(n/b)
flag = True
count = 3

while flag:
    for x in range(w_r):
        for y in range(w_g):
            for z in range(w_b):
                if n == (x*r + y*g +z*b):
                    count += 1
                else:flag = False
print(count)

Submission status: Wrong Answer

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

ans = 0

for x in range(n + 1):
    for y in range(n + 1):
        w = r * x + g * y
        if w > n:
            break
        for z in range(n + 1):
            w = w + b * z
            if w > n:
                break
            if w == n:
                ans += 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import fractions

r , g , b , n = map(int,input().split())
ans = 0
rgb = [r,g,b]
rgb.sort()
bigmax = n // rgb[2]
for big in range (bigmax+1) :
    rem = n - rgb[2] * big
    midmax = rem // rgb[1]
    step = rgb[0] // fractions.gcd(rgb[1],rgb[0])
    for mid in range(0,midmax+1,step) :
        remain = rem - rgb[1] * mid
        if remain % rgb[0] == 0 :
            ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
R,G,B,N = (int(i) for i in input().split())
maxr = N // R
maxg = N // G
maxb = N // B
result = 0

for i in range(maxr):
    for j in range(maxg):
        for k in range(maxb):
            if N == R * (i + 1) + G * (j + 1) + B * (k + 1):
                result += 1 

print(result)

Submission status: Wrong Answer

Solution code:
print("nya-n")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
R,G,B,N=map(int, input().split())
cnt=0
import math
r_range=math.ceil(N/R)+1
g_range=math.ceil(N/G)+1
for r in range(r_range):
    red = r*R
    for g in range(g_range):
        rem = (N-red-g*G)
        mod = rem % B
        if mod == 0:
            cnt+=1
print(cnt)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:


import numpy as np

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

max_R = int(np.floor(N/R))
max_G = int(np.floor(N/G))
max_B = int(np.floor(N/B))

cnt = np.int64(0)

if max_R == np.min([max_R, max_G, max_B]):
    g_vec = np.tile((np.arange(max_G)*G)[:,np.newaxis],[1,max_B])
    b_vec = np.tile((np.arange(max_B)*B)[np.newaxis,:],[max_G,1])
    mat = g_vec + b_vec
       
    for r in range(max_R+1):
        cnt += np.sum(mat + r*R == N)

elif max_G == np.min([max_R, max_G, max_B]):
    r_vec = np.tile((np.arange(max_R)*R)[:,np.newaxis],[1,max_B])
    b_vec = np.tile((np.arange(max_B)*B)[np.newaxis,:],[max_R,1])
    mat = r_vec + b_vec
        
    for g in range(max_G+1):
        cnt += np.sum(mat + g*G == N)

elif max_B == np.min([max_R, max_G, max_B]):
    r_vec = np.tile((np.arange(max_R)*R)[:,np.newaxis],[1,max_G])
    g_vec = np.tile((np.arange(max_G)*G)[np.newaxis,:],[max_R,1])
    mat = r_vec + g_vec
        
    for b in range(max_B+1):
        cnt += np.sum(mat + b*B == N)
                
print('{}'.format(cnt))

Submission status: Wrong Answer

Solution code:
R, G, B, N = map(int, input().split())
color = [R, G, B]
color.sort(reverse = True)
maxr = N // color[0]
count = 0
for i in range(maxr+1):
    nokori = N - i * color[0]
    maxg = nokori // color[1]
    for j in range(maxg+1):
        nokori = nokori - j * color[1]
        amari = nokori % color[2]
        if amari == 0:
            count += 1
print(count)

Submission status: Wrong Answer

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

cnt = 0
sum = 0

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

print(cnt)

Submission status: Wrong Answer

Solution code:
R,G,B,N = (int(i) for i in input().split())
maxr = N // R
maxg = N // G
maxb = N // B
result = 0

for i in range(maxr):
    for j in range(maxg):
        for k in range(maxb):
            if N == R * i + G * j + B * k:
                result += 1 

print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if r < b:
    hoge = r
    r = b
    b = hoge

if b < g:
    hoge = b
    b = g
    g = hoge

if r < b:
    hoge = r
    r = b
    b = hoge

kekka = 0
i = 0
while i*r <= n:
    j = 0
    while i*r+j*b <= n:
        if (n-i*r+j*b)%g == 0:
            kekka += 1
        j += 1
    i += 1
print(kekka)

Submission status: Wrong Answer

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

array = [r,g,b]
sort_array = sorted(array)

cnt = 0
n1 = sort_array[2]
n2 = sort_array[1]
n3 = sort_array[0]
r = n1
g = n2
b = n3

if r == 1 and g == 1 and b == 1:
  cnt = 4504501
if r == 2 and g == 1 and b == 1:
  cnt = 2253001

if cnt == 0:
  for rn in range(0,n + 1):
    if (r * rn) > n:
      continue
    for gn in range(0,n + 1):
      if (r * rn + g * gn) > n:
        continue
      if (n - (r * rn + g * gn)) % b == 0:
        cnt = cnt+1

print(cnt)

Submission status: Wrong Answer

Solution code:
R,G,B,N = map(int,input().split())
A = [R,G,B]
A.sort()
R = A[2]
G = A[1]
B = A[0]
rmax = N//R
gmax = N//G
bmax = N//B

cnt = 0

if R == 1:
    print(N*(N-1))
    exit()

for i in range(rmax+1):
    for j in range(gmax+1):
        if R*i + G*j > N:
            continue
        if ((N-R*i-G*j)%B == 0) and ((N-R*i-G*j)//B <= bmax):
            cnt += 1
print(cnt)

Submission status: Wrong Answer

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

print(count)

Submission status: Wrong Answer

Solution code:
R,G,B,N = map(int, input().split())
count = 0
Rc = [i * R for i in range(0, int(N / R) +1)]
Gc = [i * G for i in range(0, int(N / G) +1)]
#Bc = [i * B for i in range(0, int(N / B) +1)]
#print(Rc)
#print(Gc)
#print(Bc)
for r in Rc :
    if r == N :
        #print(r)
        count += 1
    else :
        for g in Gc :
            if r + g == N :
                #print(r, g)
                count += 1
                break
            elif r + g > N :
                break
            else :
                if (N - r + g) > B and (N - r + g) % B == 0 :
                    #print(N, r,g)
                    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
import numpy as np
from collections import Counter
R,G,B,N = list(map(int, input().split()))
a = [R, G, B]
a.sort()
a = a[::-1]
R, G, B = a

s = 0
r_cand = np.arange(0, N + 1, R)[:, None]
g_cand = np.arange(0, N + 1, B)[None, :]
rest = N - r_cand - g_cand
rest = rest[rest > 0]
c = Counter(rest)
s = 0
for k in c.keys():
    s += (k%B == 0) * c[k]

print(s)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10000)

def sub_sum(nums, total, calc_total):
    if calc_total == total:
        global g_cnt
        print (g_cnt)
        g_cnt += 1
    if calc_total > total:
        return

    for i in range(len(nums)):
        sub_sum(nums[i:], total, calc_total + nums[i])

R, G, B, N = map(int, input().split())
g_cnt = 0
sub_sum([R, G, B], N, 0)
print (g_cnt)

Submission status: Wrong Answer

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


def main():
  data = list(map(int, input().split()))
  nums = data[:-1]
  nums.sort()
  target = data[-1]

  values = [[0, 0, 0] for _ in range(target)]

  for i, n in enumerate(nums):
    if n < len(values):
      values[n - 1][i] = 1

  for i in range(1, len(values)):
    for j, n in enumerate(nums):
      if i - n < 0:
        continue

      values[i][j] += values[i - n][j]

      for k in range(j):
        values[i][j] += values[i - n][k]

  print(sum(values[-1]))


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
r,g,b,n=map(int,input().split())
a=[r,g,b]
a.sort()
a.reverse()
count=1
for i in range(n):
  for j in range(n):
    if (n-i*r-j*g)<0:break;
    if (n-i*r-j*g)%b==0: count+=1
print(count)

Submission status: Wrong Answer

Solution code:
import itertools
R,G,B,N = map(int, input().split())
count = 0
Rc = [i * R for i in range(0, int(N / R) +1)]
Gc = [i * G for i in range(0, int(N / G) +1)]
#Bc = [i * B for i in range(0, int(N / B) +1)]
#print(Rc)
#print(Gc)
#print(Bc)
for r in Rc :
    if r == N :
        #print(r)
        count += 1
    else :
        for g in Gc :
            if r + g == N :
                #print(r, g)
                count += 1
            elif r + g > N :
                break
            else :
                if (N - r + g) > B and (N - r + g) % B == 0 :
                    #print(N, r,g)
                    count += 1
print(count)
#Combi = list(itertools.product(Rc, Gc, Bc))
#print(sum([True for i in Combi if sum(i) == N]))

Submission status: Wrong Answer

Solution code:
#coding: utf-8
from math import ceil
R, G, B, N = map(int, input().split())


ans = 0

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

Submission status: Wrong Answer

Solution code:
'''
B - RGB Boxes
'''

r_weight, g_weight, b_weight, N = map(int, input().split())

ans = 0
for r in range(N+1):
    for g in range(N-r*r_weight+1):
        if (N - r*r_weight - g*g_weight) % b_weight == 0:
            ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
R,G,B,N = map(int,input().split())
A = [R,G,B]
A.sort()
R = A[0]
G = A[1]
B = A[2]
rmax = N//R
gmax = N//G
bmax = N//B

cnt = 0

if R == 1:
    print(N*(N-1)*(N-2))
    exit()

for i in range(rmax+1):
    for j in range(gmax+1):
        if R*i + G*j > N:
            continue
        if ((N-R*i-G*j)%B == 0) and ((N-R*i-G*j)//B <= bmax):
            cnt += 1
print(cnt)

Submission status: Wrong Answer

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

R,G,B,N =[int(x) for x in input().split()]
a = 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:
            a += 1
            

            
           

print(a)

Submission status: Wrong Answer

Solution code:
import numpy as np
import sys
input = sys.stdin.readline
res = 0
p = 0
R, G, B, N = map(int, input().split())
for i in range (N // R + 1):
    for j in range(N // G + 1):
        P =N - i*R - j*G
        if P < 0:
            break
        else:
            if(P % B == 0):
                res += 1

Submission status: Wrong Answer

Solution code:
r,g,b,n=map(int,input().split())
nr=n//r
nb=n//b
ans=0
lb=[b*k for k in range(nb+1)]
for i in lb:
  ng=(n-i)//g
  for j in range(ng+1):
    lb.append(i+g*j)
  lb=list(set(lb))
lb.sort()
l=len(lb)
import bisect
for i in range(nr+1):
  res=n-r*i
  idx=bisect.bisect_left(lb,res)
  if idx<l and lb[idx]==res:
    ans+=1
print(ans)

Submission status: Wrong Answer

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

R,G,B,N =[int(x) for x in input().split()]
a = 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) > 0:
            a += 1
    
            
           

print(a)

Submission status: Wrong Answer

Solution code:
import numpy as np

def main():
    R,B,G,N = list(map(int,input().split(' ')))
    cnt = 0
    for i in range(N//R+1):
        for j in range(N//G+1):
            if (N-(R*i+G*j))%G ==0:
                cnt +=1
    print(cnt)
if __name__ =='__main__':
    main()

Submission status: Wrong Answer

Solution code:
data = list(map(int, input().split()))
R = data[0]
G = data[1]
B = data[2]
N = data[3]

# R * a + G * b + B * c 

a = N // R + 1
b = N // G + 1
# c = N // B + 1
res = 0

for Ri in range(a):
    Rx = Ri * R
    if Rx > N:
        break
    for Gi in range(b):
        Gx = Gi * G
        if (N - Rx - Gx) % B == 0:
            res = res + 1
        if Rx + Gx >= N:
            break

print(res)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
b = sorted(a)
num = b[3] // b[2]
count = 0
for i in range(num+1):
  c = b[3] - (b[2] * i)
  num1 = c // b[1]
  if num1 >= 1:
    for j in range(num1+1):
      count += 1
  else:
    num2 = c // b[0]
    if num2 >= 1:
      count += 1
print(count)

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 - i * r + 1) // g ):
                if ( 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())

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

print(cnt)

Submission status: Wrong Answer

Solution code:
R, G,B,N = map(int, input().split())
l = [R,G,B]
l = sorted(l)
ma = l[2]
mi = l[0]
mid = l[1]
id = N // ma
count = 0
for i in range(id+1):
    res = N - ma * i
    if res >= mid:
        for j in range(res//mid+1):
            if res % mi == 0:
                count += 1
                res -= mid
    else:
        if res % mi == 0:
            count +=1
print(count)

Submission status: Wrong Answer

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

RGB = [R, G, B]

RGB.sort(reverse = True)
min_num = min([R,G,B])
# print(min_num)
a = N / min_num

for i in range(int(a)+1):

    if N < RGB[0]*i:
        break 
    
    else:
        for s in range(int(a)+1):
            tmp = N - RGB[0]*i - RGB[1]*s
            if tmp < 0:
                break
            
            tmp = tmp / RGB[2]

            tmp - int(tmp) == 0
            counter += 1
        
print(counter)

Submission status: Wrong Answer

Solution code:
r, b, g, n=map(int, input().split())  #複数数値入力

import numpy as np

arr =  np.array([r, b, g])
arr.sort()

comb = 0
for i in range(int(n / arr[2])+1):
#     print(i)
    for j in range(int((n - i*arr[2]) / arr[1])+1):
#         print(j)
        if (n - i*arr[2] - j*arr[1]) % arr[0] == 0:
#             print(i, j)
            comb += int((n - i*arr[2] - j*arr[1]) / arr[1]) + 1
            break
print(comb)

Submission status: Wrong Answer

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

R,G,B,N =[int(x) for x in input().split()]
a = 0
for i in range(N//R+1):
    for j in range(N):
        if N -i*R-j*G ==0:
            a += 1
            
        
        elif(N -i*R-j*G)%B == 0 and (N -i*R-j*G) > 0:
            a += 1
          
        
            
           

print(a)

Submission status: Wrong Answer

Solution code:
r, g, b, n = map(int, input().split())
count = 0
for ri in range(0, n+1, r):
  for gi in range(0, n+1, g):
    for bi in range(0, n+1, b):
      if ri + gi + bi == n:
        count += 1  
      elif ri + gi + bi < n:
        break
print(count)

Submission status: Wrong Answer

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

def f(a, b):
    sho, amari = int(a/b), a%b
    return sho, amari


def ans(l, m, s):
    cnt = 0

    R_s, R_a = f(N, l)

    for i in range(R_s + 1):
        x = R_a + i * l # R を i 個使う
        G_s, G_a = f(x, m)
        for j in range(G_s + 1):
            y = G_a + j * m # G を j 個使う
            if G_a % s == 0:
                cnt += 1
    return cnt

li = [R, G, B]
li.sort(reverse=True)

cnt = ans(li[0], li[1], li[2])

print(cnt)

Submission status: Wrong Answer

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

RGB = [R, G, B]
RGB.sort(reverse=True)

cnt = 0
NR = N//RGB[0]
NG = N//RGB[1]
for r in range(NR + 1):
  for g in range(NG + 1):
    NrRgG = N - (r*R + g*G)
    if NrRgG < 0:
      break
    elif NrRgG >= 0:
      if NrRgG % RGB[2] == 0:
        cnt += 1
print(cnt)

Submission status: Wrong Answer

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

result = 0

max_r = n // r

for i in range(max_r + 1):
    max_g = (n - i * r) // g + 1
    for j in range(max_g):
        if i * r + j * g > n:
                continue
        max_b = (n - i * r - j * g) // b + 1
        if (n - i * r + j * g ) % b == 0:
            result += 1
print(result)

Submission status: Wrong Answer

Solution code:

import numpy as np

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

max_R = int(np.floor(N/R))
max_G = int(np.floor(N/G))
max_B = int(np.floor(N/B))

r_vec = np.tile((np.arange(max_R)*R)[:,np.newaxis],[1,max_G])
g_vec = np.tile((np.arange(max_G)*G)[np.newaxis,:],[max_R,1])
mat = r_vec + g_vec

cnt = 0

for b in range(max_B+1):
    cnt += np.sum(mat + b*B == N)
                
print('{}'.format(cnt))

Submission status: Wrong Answer

Solution code:
import math

line=input().split(" ")
n=int(line[3])
r=int(line[0])
g=int(line[1])
b=int(line[2])
nline=sorted([r,g,b])
x=int(nline[2])
y=int(nline[1])
z=int(nline[0])

answers=0
#print(x,y,z,n)


for i in range(math.ceil(n/x)+1):
    a=i
    if z!=1:
        for j in range(math.ceil(n/y)+1-a*x):
            b=j
            c=(n-a*x-b*y)/z
            if c>=0 and (n-a*x-b*y)%z==0:
                answers+=1
                #print(a,b,c)
    else:
        if n-a*x>=0:
            if n-a*x==0:
                answers+=1
                #print('a', 1)
            elif (n-a*x)%y!=0:
                answers+=math.ceil((n-a*x)/y)
                #print('b', math.ceil((n-a*x)/y))
            else:
                answers+=(math.ceil((n-a*x)/y)+1)
                #print('c', math.ceil((n-a*x)/y)+1)
            

print(answers)

Submission status: Wrong Answer

Solution code:
import math
import random as rd
import numpy as np

a,b,c,n=map(int,input().split( ))

s=0
for i in range(n//a+1):
    for j in range((n-a+i)//b+1):
        ck=(n-a*i-b*j)
        if ck%c==0 and ck//c>=0:
            s+=1
        # print(i,j,ck,s)

print(s)

Submission status: Wrong Answer

Solution code:
import bisect
import numpy as np
import scipy as sp
from sys import stdin

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

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

print(count)

Submission status: Wrong Answer

Solution code:
import numpy as np
R, B, G, N = (int(x) for x in input().split())
a = np.array([R, B, G])
a = np.sort(a)
b = a[2]
d = a[1]
f = a[0]
c = int(N / b)

count = 0

for i in range(c + 1):
    n = N - b * i
    e = int(n / d)
    for j in range(e + 1):
        m = n - d * j
        if m % a[0]:
            count += 1

print(count)

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/diverta2019/tasks/diverta2019_b
import itertools
from collections import Counter
from collections import defaultdict
import bisect

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

    ans = 0
    for r in range(3000):
        rest = N - r * R
        if rest < 0:
            break
        for g in range(3000):
            rest_2 = rest - g * G
            if rest_2 >= 0 and rest_2 % B == 0:
                ans += 1
                # print('r {}, g {}, b {}'.format(r, g, rest // B))
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
raw =  input().split()
R = int(raw[0]) 
G = int(raw[1]) 
B = int(raw[2])
N = int(raw[3])

total = N
ans = 0
remain = 0

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

Submission status: Wrong Answer

Solution code:
from io import StringIO
from collections import *
from functools import *
import sys


def main(inputs):
    # n = int(next(inputs))
    # xs = list(map(int, next(inputs).split()))
    r, g, b, n = list(map(int, next(inputs).split()))
    ans = 0
    for i in range(1 + (n // r)):
        n_r = n - r * i
        for j in range(1 + (n_r // g)):
            n_g = n_r - g * j
            if n_g % b == 0:
                print("{}".format((i, j)))
                ans += 1
                pass
            pass
        pass
    return ans


def gen_inputs(str_=None):
    inputs = StringIO(str_) if str_ else sys.stdin
    while True:
        a = inputs.readline().rstrip()
        yield a
        pass
    pass


if __name__ == "__main__":
    print(main(gen_inputs()))
    pass

Submission status: Wrong Answer

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

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

print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for x in range(math.ceil(N/r)+1):
    for y in range(math.ceil((N-x*r)/g)+1):
        if  (N - x*r - y*g)%b == 0:
            count +=1

print(count)

Submission status: Wrong Answer

Solution code:
import math

line=input().split(" ")
n=int(line[3])
r=int(line[0])
g=int(line[1])
b=int(line[2])
nline=sorted([r,g,b])
x=int(nline[2])
y=int(nline[1])
z=int(nline[0])

answers=0
#print(x,y,z,n)


for i in range(math.ceil(n/x)+1):
    a=i
    if z!=1:
        for j in range(math.ceil(n/y)+1-a*x):
            b=j
            c=(n-a*x-b*y)/z
            if c>=0 and (n-a*x-b*y)%z==0:
                answers+=1
                #print(a,b,c)
    else:
        if n-a*x>=0:
            if (n-a*x)%y!=0:
                answers+=math.ceil((n-a*x)/y)
                #print(math.ceil((n-a*x)/y))
            else:
                answers+=(math.ceil((n-a*x)/y)+1)
            

print(answers)

Submission status: Wrong Answer

Solution code:
import itertools
R,G,B,N = map(int, input().split())
count = 0
Rc = [i * R for i in range(0, int(N / R) +1)]
Gc = [i * G for i in range(0, int(N / G) +1)]
Bc = [i * B for i in range(0, int(N / B) +1)]
print(Rc)
print(Gc)
print(Bc)
Combi = list(itertools.product(Rc, Gc, Bc))
print(sum([True for i in Combi if sum(i) == N]))

Submission status: Wrong Answer

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

# R*x + G*y + B*z = N
for x in range(int(N / R)):
    for y in range(int(N / G)):
        for z in range(int(N / B)):
            if R*x + G*y + B*z > N:
                break
            elif R*x + G*y + B*z == N:
                ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
R,G,B,N=map(int,input().split())
from math import ceil
cnt=0

for r in range(ceil(N/R)+1):
    for g in range(ceil((N-R*r)/G)+1):
        if (N - R * r - G * g) == 0:
            cnt +=1
        elif (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())

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

print(cnt)

Submission status: Wrong Answer

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

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

l = []
l.append(r)
l.append(g)
l.append(b)

l.sort(reverse = True)

cnt = 0
sum = 0
for i in range(n//l[0]+1):
    sum = i*l[0]

    for j in range((n-sum)//l[1]+1):
        sum = sum + j*l[1]

        if (n - sum)%l[2] == 0:
            cnt = cnt +1

print(cnt)

Submission status: Wrong Answer

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

for n in range(N):
  for n2 in range(N):
    s = n * R + n2 * G
    if(N-s >= 0 and (N-s) % B == 0):
      ans += 1
print(ans+1)

Submission status: Wrong Answer

Solution code:
R, G, B, N =list(map(int, input().split()))
# R = 13
# G = 1
# B = 4
# N = 3000
X, Y, Z = sorted([R, G, B], reverse=True)
cnt = 0
for i in range(N+1):
    if (X*i>N): break
    for j in range(N+1):
        if (X*i+Y*j>N): break
        cnt += ((N-X*i+Y*j)%Z == 0)
print(cnt)

Submission status: Wrong Answer

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

for r in range(3001):
    for g in range(3001):
        for b in range(3001):
            print(r,g,b)
            print(R * r + G * g + B * b)
            if R * r + G * g + B * b == N:
                answer += 1
                break
            elif R * r + G * g + B * b > N:
                break
        if R * r + G * g> N:
            break
    if R*r>N:
        break
print(answer)

Submission status: Wrong Answer

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

print(cnt)

Submission status: Wrong Answer

Solution code:
R,G,B,N=map(int,input().split())
from math import ceil
cnt=0

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

print(cnt)

Submission status: Wrong Answer

Solution code:
l = raw_input().split()
M = [0]*3
M[0] = int(l[0])
M[1] = int(l[1])
M[2] = int(l[2])
N = int(l[3])
M.sort()

#print(M, N)

count = 0

for i in range(N / M[2] + 1):
    remain = N - i * M[2]
 #   print('i', i, remain)
    for j in range(remain / M[1] + 1):
        remain -= j * M[1]
#        print('j', j, remain)
        if remain % M[0] == 0:
 #           print('ans', i, j, remain / M[0])
            count += 1

print(count)

Submission status: Wrong Answer

Solution code:
def solve():
    R, G, B, N = [int(_) for _ in raw_input().split()]
    X = min(R, G, B)
    if X == R:
        Y = min(G,B)
        Z = max(G,B)
    elif X == G:
        Y = min(R,B)
        Z = max(R,B)
    else:
        Y = min(G,B)
        Z = max(G,B)
    ret = 0
    for i in range(N/Z, -1, -1):
        sum1 = N - i * Z
        for j in range(sum1/Y, -1, -1):
            sum2 = N - i * Z - j * Y
            if sum2 % X == 0:
                ret += 1
    print str(ret)

if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import math

line=input().split(" ")
n=int(line[3])
r=int(line[0])
g=int(line[1])
b=int(line[2])
nline=sorted([r,g,b])
x=int(nline[2])
y=int(nline[1])
z=int(nline[0])

answers=0
#print(x,y,z,n)


for i in range(math.ceil(n/x)+1):
    a=i
    if z!=1:
        for j in range(math.ceil(n/y)+1-a*x):
            b=j
            c=(n-a*x-b*y)/z
            if c>=0 and (n-a*x-b*y)%z==0:
                answers+=1
                #print(a,b,c)
    else:
        if (n-a*x)%y!=0:
            answers+=math.ceil((n-a*x)/y)
        else:
            answers+=(math.ceil((n-a*x)/y)+1)
        

print(answers)