Problem:


Score: 300 points

Problem Statement

AtCoder Mart sells 1000000 of each of the six items below:

Riceballs, priced at 100 yen (the currency of Japan) each

Sandwiches, priced at 101 yen each

Cookies, priced at 102 yen each

Cakes, priced at 103 yen each

Candies, priced at 104 yen each

Computers, priced at 105 yen each

Takahashi wants to buy some of them that cost exactly X yen in total.
Determine whether this is possible.

(Ignore consumption tax.)

Constraints

1 \leq X \leq 100000

X is an integer.

Input

Input is given from Standard Input in the following format:

X

Output

If it is possible to buy some set of items that cost exactly X yen in total, print 1; otherwise, print 0.

Sample Input 1

615

Sample Output 1

1

For example, we can buy one of each kind of item, which will cost 100+101+102+103+104+105=615 yen in total.

Sample Input 2

217

Sample Output 2

0

No set of items costs 217 yen in total.



Sample input:
615


Sample output:
1

Submission status: Runtime Error

Solution code:
x = int(input())

nokori = x%100
max_n = x//100
print(int(nokori/5) + int(nokori%5/4) + int(nokori%5%4/3) + int(nokori%5%4%3/2) + int(nokori%5%4%3%2)
if max_n < int(nokori/5) + int(nokori%5/4) + int(nokori%5%4/3) + int(nokori%5%4%3/2) + nokori%5%4%3%2:
    print(0)
else:
    print(1)

Submission status: Runtime Error

Solution code:
x = input()

d1 = int(x[:-2])
d2 = int(x[-2:])
n = -(-d2//5)

print('1' if d1-n>=0 else '0')

Submission status: Runtime Error

Solution code:
import math
N = input()
A = [100, 101, 102, 103, 104, 105]
if len(str(N))  < 2:
  print(0)
  quit()
last = int(N[-2] + N[-1])
head = int(N[0:-2])
if last / head <= 5:
  print(1)
else:
  print(0)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
////////////////////////////

int main(){fastio
    ll x;cin>>x;
    bool dp[x+1];
    memset(dp,false,sizeof(dp));
    dp[0]=true;
    rep(i,100,105){
        for(ll j=x;j>=0;j--){
            if(j-i>=0)dp[j]|=dp[j-i];
        }
    }
    /*for(ll i=0;i<=x;i++){
        cout<<dp[i]<<" ";
    }*/
    cout<<dp[x]<<endl;
    
    return 0;
}

Submission status: Runtime Error

Solution code:
x = int(input())
y = int(str(x)[:-2])
z = int(str(x)[-2:])
if x < 100:
    print(0)
    exit()
elif (y*5) < z:
    print(0)
    exit()
else:
    print(1)

Submission status: Runtime Error

Solution code:
from math import ceil
N = int(input())
t, s = str(N)[:-2], str(N)[-2:]
# print(t, s)
if int(t) >= ceil(int(s)/5):
    print(1)
else:
    print(0)

Submission status: Runtime Error

Solution code:
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys

sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline--------------------------------------------        ]
    X = int(input())
    sx = str(X)
    lsx = len(sx)
    sx1 = sx[:lsx-2]
    sx2 = sx[lsx-2:]
    if int(sx1)*5 >= int(sx2):
        print(1)
    else:
        print(0)
if __name__ == "__main__":
    main() #endline===============================================

Submission status: Runtime Error

Solution code:
n = int(input())

def judge(ad,n):
    n -= ad
    if n == 0:
        return 1
    elif n < 0:
        return 0
    r1 = judge(100,n)
    r2 = judge(101,n)
    r3 = judge(102,n)
    r4 = judge(103,n)
    r5 = judge(104,n)
    r6 = judge(105,n)
    return max(max(max(r1,r2),max(r3,r4)),max(r5,r6))

print(judge(0,n))

Submission status: Runtime Error

Solution code:
import numpy as np
x = int(input())
dp = np.zeros(x)

def cal(ar):
  tof = 0
  for i in ar:
    if i == 1:
      tof = 1
      break
  return tof
dp[0] = 1
for i in range(99,105):
  dp[i] = 1
for i in range(105, x):
  dp[i] = cal(dp[i-105:i-100])
print(int(dp[x-1]))

Submission status: Runtime Error

Solution code:
X = int(input())
items = range(100, 106)


def cal(x):
    if x == 0:
        print(1)
        exit()

    for i in items:
        if x >= i:
            cal(x-i)


cal(X)
print(0)

Submission status: Runtime Error

Solution code:
from itertools import combinations_with_replacement

X = list(input())
tmp = X
num = int("".join(tmp))

X.pop()
X.pop()
X = int("".join(X))

food = [100, 101, 102, 103, 104, 105, 106]

for i in combinations_with_replacement(food, X):
    if sum(i) == num:
        print(1)
        exit()

print(0)

Submission status: Runtime Error

Solution code:
import sys
x=(input())
n=int(x[:-2])
t=int(x[-2]+x[-1]) 
if n > 10:
    n = 10
ans = 0
p = 0
for i in range(1,n):#0
    for j in range(1,n):#1
        for k in range(1,n):#2
            for l in range(1,n):#3
                for m in range(1,n):#4
                    for o in range(1,n):#5
                        ans += i*0+j*1+k*2+l*3+m*4+o*5
                        if ans == t:
                            print(1)
                            sys.exit()
                            
print(0)

Submission status: Runtime Error

Solution code:
x = input()

x1 = int(x[:-2])
x2 = int(x[-2:])

c = int(x2 // 5) + 1

if x1 >= c:
	print(1)
else:
	print(0)

Submission status: Runtime Error

Solution code:
x=int(input())
if x>=2000:
    print(1)
else:
    a=x//100
    #print(a)
    n=x-a*100
    #print(n)
    if n/a>5:
        print(0)
    else:
        print(1)

Submission status: Runtime Error

Solution code:
x = input()
s = list(x)
x = int(x)

xx = int(s[-2]+s[-1])
num_item = xx//5
if xx%5 != 0:
    num_item += 1

hun = int(''.join(s[0:-2]))
if hun < num_item:
    print(0)
else:
    print(1)

Submission status: Runtime Error

Solution code:
n=input()
a=n[-2]+n[-1]
if a=="00":
  c=0
else:
  c=int(a)
b=int(n)//100
if b*5<c:
    print(0)
else:
    print(1)

Submission status: Runtime Error

Solution code:
x = int(input())

shimo2 = int(str(x)[-2:])
ue = int(str(x)[:-2])

nums = [0]*6

for i in [5,4,3,2,1]:
    nums[i] = shimo2//i
    shimo2 -= nums[i]*i

if ue >= sum(nums):
    print(1)
else:
    print(0)

Submission status: Runtime Error

Solution code:
def solve():
    X = input()
    twoDig = int(X[len(X)-2:])
    rest = int(X[:len(X)-2])

    ans = '1'
    for i in range(rest+1):
        if twoDig == 0:
            break
        for n in range(5, 0, -1):
            if twoDig - n >= 0:
                twoDig -= n
                break
    else:
        ans = '0'
    
    print(ans)

if __name__ == '__main__':
    solve()

Submission status: Runtime Error

Solution code:
inpl = lambda: list(map(int,input().split()))
X = int(input())
if X < 100:
    print(0)
elif X <= 105:
    print(1)
dp = [False]*(X+1)
goods = list(range(100,106))
dp[0] = True
for k in goods:
    dp[k] = True

for i in range(200, X+1):
    for k in goods:
        if dp[i-k]:
            dp[i] = True
            break
if dp[X]:
    print(1)
else:
    print(0)

Submission status: Runtime Error

Solution code:
n = input()
num = int(n[0:-2])
yen = int(n[-2::])
if num * 5 >= yen:
    print(1)
else:
    print(0)

Submission status: Runtime Error

Solution code:
n=input()
a=int(n[-2]+n[-1])
b=int(n)//100
if b*5<a:
    print(0)
else:
    print(1)

Submission status: Runtime Error

Solution code:

def main():
    X = int(input())
    A = [False]*(10**5 + 1)
    A[100] = True
    A[101] = True
    A[102] = True
    A[103] = True
    A[104] = True
    A[105] = True
    for i in range(100,X+1):
        if A[i]:
            A[i+100] = True
            A[i+101] = True
            A[i+102] = True
            A[i+103] = True
            A[i+104] = True
            A[i+105] = True
    if A[X]:
        print(1)
    else:
        print(0)
    return 

main()

Submission status: Runtime Error

Solution code:
X % 100 = n
X / 100 = m

if n > m * 5:
  print(0)

else:
  print(1)

Submission status: Runtime Error

Solution code:
N = int(input())

import sys
sys.setrecursionlimit(10 ** 9)

memo = [-1] * (N + 1)

def dfs(x):
    if x >= 0 and memo[x] != -1:
        return memo[x]
    ans = False
    if x == 0:
        memo[x] = 1
        return True
    elif x < 0:
        memo[x] = 0
        return False
    else:
        ans |= dfs(x - 100)
        ans |= dfs(x - 101)
        ans |= dfs(x - 102)
        ans |= dfs(x - 103)
        ans |= dfs(x - 104)
        ans |= dfs(x - 105)
    memo[x] = 1 if ans else 0
    return ans
if dfs(N):
    print(1)
else:
    print(0)

Submission status: Runtime Error

Solution code:
memo = {}

def judge(x):
	if x < 0:
		return False
	elif x == 0:
		return True
	else:
		if x not in memo:
			memo[x] = judge(x - 100) or judge(x - 101) or judge(x - 102) or judge(x - 103) or judge(x - 104) or judge(x - 105)
		return memo[x]


if __name__ == "__main__":
	X = int(input())
	if judge(X):
		print(1)
	else:
		print(0)

Submission status: Runtime Error

Solution code:
N = int(input())

import sys
sys.setrecursionlimit(10 ** 9)

memo = [-1] * (N + 1)

def dfs(x):
    if memo[x] != -1:
        return memo[x]
    ans = False
    if x == 0:
        memo[x] = 1
        return True
    elif x < 0:
        memo[x] = 0
        return False
    else:
        ans |= dfs(x - 100)
        ans |= dfs(x - 101)
        ans |= dfs(x - 102)
        ans |= dfs(x - 103)
        ans |= dfs(x - 104)
        ans |= dfs(x - 105)
    memo[x] = 1 if ans else 0
    return ans
if dfs(N):
    print(1)
else:
    print(0)

Submission status: Runtime Error

Solution code:
def main():
    X = input()
    under2 = int(X[-2] + X[-1])
    X = int(X)

    if X < 100:
        ans = 0
    else:
        if under2 <= 5:
            ans = 1
        else:
            cnt = 0
            while under2 > 5:
                under2 -= 5
                cnt += 1
            cnt += 1

            if X >= cnt * 100:
                ans = 1
            else:
                ans = 0
    
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:

x = int(input())

def dp(rest):
  if rest<200:
    if 100<=rest and rest<=105:
      return True
    else:
      return False
  else:
    ret01 = dp(rest-100)
    ret02 = dp(rest-101)
    ret03 = dp(rest-102)
    ret04 = dp(rest-103)
    ret05 = dp(rest-104)
    ret06 = dp(rest-105)
    if ret01 or ret02 or ret03 or ret04 or ret05 or ret06:
      return True
    else:
      return False


if dp(x):
  ret="1"
else:
  ret="0"

print(ret)

Submission status: Runtime Error

Solution code:
X = input()
x = int(X[-2] + X[-1])
X = (int(X)-x)//100
if x > 5*X:
    print(0)
else:
    print(1)

Submission status: Runtime Error

Solution code:
x=int(input())
if x%100/(x//100)>5:
    print(0)
else:
    print(1)

Submission status: Runtime Error

Solution code:
X = int(input())
N = X // 100
n = X % 100

if n / N > 5:
  print(0)
else:
  print(1)

Submission status: Runtime Error

Solution code:
x = int(input())

res = [False for i in range(x + 1)]
res[0] = True
for i in range(100, 106):
    res[i] = True

for i in range(106, x + 1):
    res[i] = res[i-100] or res[i-101] or res[i-102] or res[i-103] or res[i-104] or res[i-105]

if res[x]:
    print(1)
else:
    print(0)

Submission status: Runtime Error

Solution code:
x = int(input())

dp = [0] * (x + 1)
cost = [100, 101, 102, 103, 104, 105]

dp[0] = 1
for _x in range(1, x + 1):
    for c in cost:
        if dp[_x - c] == 1:
            dp[_x] = 1
            continue

if dp[-1]:
    print('1')
else:
    print('0')

Submission status: Runtime Error

Solution code:
from functools import lru_cache

X = int(input())

@lru_cache(None)
def rec(x):
    if x == 0:
        return True
    if x < 0:
        return False
    return any(rec(x-100-d) for d in range(6))

print(1 if rec(X) else 0)