Problem:


Score : 200 points

Problem Statement

Let S(n) denote the sum of the digits in the decimal notation of n.
For example, S(101) = 1 + 0 + 1 = 2.

Given an integer N, determine if S(N) divides N.

Constraints

1 \leq N \leq 10^9

Input

Input is given from Standard Input in the following format:

N

Output

If S(N) divides N, print Yes; if it does not, print No.

Sample Input 1

12

Sample Output 1

Yes

In this input, N=12.
As S(12) = 1 + 2 = 3, S(N) divides N.

Sample Input 2

101

Sample Output 2

No

As S(101) = 1 + 0 + 1 = 2, S(N) does not divide N.

Sample Input 3

999999999

Sample Output 3

Yes



Sample input:
12


Sample output:
Yes

Submission status: Runtime Error

Solution code:
N = STDIN

dsum = 0
tmp = N

while tmp >= 1:
  digit = tmp % 10
  dsum = dsum + digit
  tmp = tmp / 10

if N % dsum != 0:
  print "No"
else:
  print "Yes"

print dsum

Submission status: Runtime Error

Solution code:
n=int(input())
N=str(n)
z=0
for i in range(len(N)):
  z+=N[i]
if n%z==0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
sn = sum(list(map(int, n.split())))
if n % sn == 0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
N = input()
print("No" if N % sum(int(x) for x in N) else "Yes")

Submission status: Runtime Error

Solution code:
import sys
import string
input=sys.stdin.readline

n=(input())
l=list(n)
n=int(n)
a=0
for i in range(len(l)):
    a+=int(l[i])
if n%a==0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
n= input()
t = list(n)
t = [int(i) for i in t]
s = 0
for j in t:
  s += j

if n % s == 0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
while tmp > 0:
    sum += tmp % 10
    tmp /= 10

if n % sum == 0:
    print ("Yes")
else:
    print ("No")

Submission status: Runtime Error

Solution code:
while tmp > 0:
    sum += tmp % 10
    tmp /= 10

if n % sum == 0:
    print "Yes"
else:
    print "No"

Submission status: Runtime Error

Solution code:
n = int(input())
s_n = 0
for i in str(n):
    s_n += i
if n%s_n == 0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
s = 0
for i in range(len(str(n))):
  s += list(str(n))[i]
if n % s == 0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
S=0
N=int(input())
tmp=N
while tmp!=0:
    S+=N%10
    tmp//=10
if N%S==0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
n = input()
nl = [int(i) for i in n]
ns = sum(nl)
print(["No", "Yes"][n % ns == 0])

Submission status: Runtime Error

Solution code:
s = raw_input()
sum = 0
for i in range(0, len(s)):
	sum = int(s[i])
if int(s) % sum == 0: print 'Yes'
else: print 'No'

Submission status: Runtime Error

Solution code:
N=int(input())
n=list(str(N))
n=[int(n) for i in n]
summer=sum(n)
if N%summer==0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
s = input()
if s % sum(map(int, list(s))):
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
def sum_digits(n):
    s = 0
    while n:
        s += n % 10
        n //= 10
    return s


while True:
    num = int(input())
    if num % sum_digits(num) == 0:
        print('Yes')
    else:
        print('No')

Submission status: Runtime Error

Solution code:
s=input()
s1=0
for i in s:
    s1+=int(i)
if int(s)%s==0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
A = input()

S = 0
for i in A:
  S = S + A(i)
  
if (int(A) % S) == 0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
A = input()

S = 0
for i in A:
  S = S + A[i]
  
if int(A) % S == 0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
A = input()

S = 0
for i in A:
  S += A[i]
  
if int(A) % S == 0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
A = input()

S = 0
for i in range(0,10):
  S += A[i]
  
if int(A) % S == 0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
A = input()

S = 0
for i in range(0,10):
  S += A[i]
  
if A % S == 0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
n = int(input()) 
row = map(int, input().split())
max = row[0]
min = 0

for i  in range(n-1):
    if(row[i] < row[i+1]):
        max = row[i+1]

for i in range(n-1):
    if(row[i] > row[i+1]):
        min = row[i+1]

print(max-min)

Submission status: Runtime Error

Solution code:
print(*["YNeos"[(int(s)%sum(int(i))for i in s)>0::2]for s in[input()]])

Submission status: Runtime Error

Solution code:
print(*[["Yes","No"][int(s)%sum(int(i)for i in s)]for s in[input()]])

Submission status: Runtime Error

Solution code:
a=input()
l=[int(i) for i in list(str(a))]
s=0
for i in l:
  s+=i
if a % s==0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
N = int(input())
S = list(str(N))

sn = 0
for s in S:
    sn += s

if N % sn == 0:
    print("yes")
else:
    print("no")

Submission status: Runtime Error

Solution code:
n = input()
n_ = sum([int(x) for x in n])
print("Yes" if n%n_ == 0 else "No")

Submission status: Runtime Error

Solution code:
# your code goes here
import copy
N=int(input())
k = copy.copy(N)
 
a=[]
while k != 0:
	a.append(k%10)
	k = k//10
 
if N%sum(a)==0:
	print('Yes')
else:
	print('No'

Submission status: Runtime Error

Solution code:

D, W = map(int, input().split())
if W == 100:
    print(101*(100**D))
else:
    print(W*(100**D))

Submission status: Runtime Error

Solution code:
N = input()
num = list(N)
s = 0
for i in range(N):
  s += num[i]
if int(N) % s == 0:
  print(Yes)
else:
  print(No)

Submission status: Runtime Error

Solution code:
N = int(input())
num = list(N)
s = 0
for i in range(len(num)):
  s += num[i]
if N % s == 0:
  print(Yes)
else:
  print(No)

Submission status: Runtime Error

Solution code:
def main():
    N = input()
    Sn = 0
    for n in N: Sn += int(n)
    print(Yes if int(N) % Sn == 0 else 'No')
    
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>

using namespace std;
char a[15];
int main(){
    scanf("%s", a);
    int lsum = 0, sum = 0;
    for(int i = 0; i < strlen(a); i++){
        lsum += a[i] - '0';
        sum   = sum * 10 + a[i] - '0';
    }
    if(sum % lsum == 0) printf("Yes\n");
    else printf("No\n");
}

Submission status: Runtime Error

Solution code:
N = input("N:")
mapped_N  = map(int, list(N))
sum_s = sum(list(mapped_N))
if N % sum_s == 0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N = input()
if N % sum([int(i) for i in str(N)]) == 0: print('Yes')
else: print('No')

Submission status: Runtime Error

Solution code:
n=input()
print(["Yes","No"][int(n)%sum(list(map(int,list(n))))])

Submission status: Runtime Error

Solution code:
s = input()
a = 0
for i in range(len(s)):
    a += s[i]
s = int(s)
if s % a = 0 :
    print('Yes')
else :
    print('No')

Submission status: Runtime Error

Solution code:
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(a):
    s = 0
    for b in str(a):
        s += int(b)
    if a%s==0:
        return "Yes"
    else:
        return "No"
        
# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    return line

def main():
    n = readQuestion()
    answer = solve(n)
    print(answer)
    
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys

def solve (N):
    s=0
    for b in str(N):
        s = s + int(b)
    if N % s ==0:
        return 'Yes'
    else:
        return 'No'

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(n):
   
# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    return int(line)

def main():
    n = readQuestion()
    answer = solve(n)
    print(answer)
    
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys

def solve(n):
    a = 0
    for s in str(n):
        a += int(s)
    if n%a == 0:
        return("Yes")
    else:
        return("No")

def readQuestion():
    line = sys.stdin.readline().rstrip()
    [str_a] = line.split(' ')
    return (int(str_a)

def main():
    a = readQuestion()
    answer = solve(a)
    print(answer)
    
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
S = input()
inputInInt = int(S)
sum = 0
for i in range(S):
    sum += S[i]

if inputInInt % sum is 0:
    print('YES')
else:
    print('No')

Submission status: Runtime Error

Solution code:
n_str = raw_input()
n = int(n_str)
total = sum(map(int, list(n_str)))
if n % total == 0:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
a = list(input())
su = 0
s = 0
k = 0
for i in a:
  s += int(i)
a.reverse()
for i in a:
  su += i*pow(10,k)
  k += 1
  
if su % s == 0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
def cal(n):
  ans = 0
  while n != 0:
    ans += n % 10
    n /= 10
  return n

n = int(raw_input())
if n % cal(n) == 0:
  print "Yes"
else:
  print "No"

Submission status: Runtime Error

Solution code:
Nstr = input()
SN = 0
for i in N:
    SN += int(i)
if int(N) % SN == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
s=int(input())
d=0
while s!=0:
	d+=s%10
    s=s//10
print(["YES","NO"][s%d])

Submission status: Runtime Error

Solution code:
s=input()
print("Yes" if int(s) % sum(list(s)) ==0 else "No")

Submission status: Runtime Error

Solution code:
N0 = int(input())
N1 = list(map(int,str(N0)))
S_N = 0

for i in range(len(N)):
    S_N += N1[i]

if N0 % S_N == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
N0 = int(input())
N1 = list(map,N0)
S_N = 0

for i in range(len(N1)):
    S_N += N1[i]

if N0 % S_N == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
N0 = int(input())
N1 = list(map,N0)
S_N = 0

for i in range(len(N)):
    S_N += N[i]

if N % S_N == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
a=int(input())
n=list(str(a))
N=map(int,n)
an=0
lena=len(n)
for i in range(lena):
    an += N[i]
if a % an ==0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
N = input()
s = 0
for n in N:
  s += int(n)
res = int(N) % s
if res == 0:
  print("Yes")
else
  print("No")

Submission status: Runtime Error

Solution code:
N = input()
sum = 0
for n in N:
  sum += int(n)
res = int(N) % sum
if res == 0:
  print("Yes")
else
  print("No")

Submission status: Runtime Error

Solution code:
N = input()
sum = 0
for n in N:
  sum += int(n)
res = int(N) % sum
if res == 0:
  print("yes")
else
  print("no")

Submission status: Runtime Error

Solution code:
n = int(input())
l = [int(x) for x in list(str(n))]

s = 0
for x < len(n):
    s = 0 + int(l_[x])
    x += 1

if n % s == 0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
s=input()
n=int(s)
sn=0
for d in s:
  sn+=int(d)
if n%sn==0:
  Print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
i = 0
wa = 0
while i < len(str(N)):
    wa = wa + int(str(N)[i:i+1])
    i += 1
if N % wa == 0:
    print("Yes")
elif N % wa != 0:
    print("No")

Submission status: Runtime Error

Solution code:
i = 0
wa = 0
while i len(str(N)):
  wa = wa + int(str(N)[i:i+1])
  i += 1
if N % wa == 0:
  print("Yes")
elif N % wa != 0:
  print("No")

Submission status: Runtime Error

Solution code:
import sys,collections,math;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

n,k = Is()
ls = Is()
_1 = ls.index(1)
if _1 < k-1:
    _1 = k-1
elif _1 < n-k:
    _1 = n-k
print(math.ceil(_1/(k-1))+math.ceil((n-1-_1)/(k-1)))

Submission status: Runtime Error

Solution code:
N = input()
N = int(N)

res = 0
for i in range(9):
    hoge = pow(10, i)
    res += (N / hoge) % 10

if(N % res == 0):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N = input()
numN = int(N)
S =0
for i in range(len(N)):
    S += int(N[i])
 
if nunN % S == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
s = input()
n = int(s)
sum =0
mir = n
for i in range(len(s)):
  sum += s[i]
if n%sum ==0:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
n=input()
N=int(n)
tmp=list(n)

c=0
for i in tmp():
    c+=int(i)

if N%c==0:
    print("yes")
else:
    print("no")

Submission status: Runtime Error

Solution code:
n , k = map(int, input().split())
print(n//(k-1))

Submission status: Runtime Error

Solution code:
n = input()

sn = 0
for i in range(n):
    sn += int(n[i])

n = int(n)

print('Yes') if n % sn else print('No')

Submission status: Runtime Error

Solution code:
N=int(input())
dSum=0
tmpN=N
while tmpN>=10:
    dSum+=tmpN%10
    tmpN/=10
if N%dSum==0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N=input()
Nstring=str(N)
i=0
S=0#各桁の輪
while i<len(Nstring):
    S+=int(Nstring[i])
    i+=1

if N%S==0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
def main14():
    strbuf = input('');
    num = int(strbuf);
    kari = num;
    peku = 0;
    while(True):
        iti = int(kari % 10);
        peku = iti;
        if(iti<10):
            break;
        kari = (kari - iti) / 10;
    if((int(num % peku) == 0)):
        print("Yes");
    else:
        print("No");

def main15():
    strbuf1 = input('');
    strbuf2 = input('');
    buf1 = [];
    buf2 = []
    for i in range(2):


if __name__ == '__main__':
    main14()

Submission status: Runtime Error

Solution code:
# https://beta.atcoder.jp/contests/abc101/tasks/abc101_b
# B - Digit Sums

# B_Digit_Sums.py

N = int(input())
str_N = str(N)

S_N = 0
for i in range(str_N):
    S_N += ( N % (10 ** (i+1)) ) // ( N // (10 ** i) )
print(S_N)

Submission status: Runtime Error

Solution code:
N = int(input())
sum = 0

while N > 0:
    sum += N % 10
    N = N // 10

if sum % N == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
n=input()
s=0
for i in range(len(n)):
    s+=int(n[i])

if int(n)%s==0:
    print('Yes')
else:
    print('No')
tanakashunshounoMacBook-P

Submission status: Runtime Error

Solution code:
)
S = 0
for lit in str(N):
    S += int(lit)

if(N % S == 0):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
input_str = input()
sum = 0
for dig in input_str:
    sum += int(dig)

if int(input_str) % sum == 0
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
def main14():
    strbuf = input('');
    num = int(strbuf);
    kari = num;
    peku = 0;
    while(True):
        iti = int(kari % 10);
        peku = iti;
        if(iti<10):
            break;
        iti = (kari - iti) / 10;
    if((int(num % peku) == 0)):
        print("Yes");
    else:
        print("No");

if __name__ == '__main__':
    main14()

Submission status: Runtime Error

Solution code:
N = input()
S = sum(map(int, N))

if N % S == 0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N = input()
mod = int(N[0] + N[1] + N[2])

print("Yes" if int(N) % mod == 0 else "No")

Submission status: Runtime Error

Solution code:
N = input().strip()

SN = sum(int(c) for c in N)

if N % SN == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
N = input()
numN = int(N)
S =0
for i in range(len(N)):
    S += int(N[i])

if N % S == 0:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
n = int(input())
sn = 0
k = n
while k // 10 != 0:
    sn += k % 10
    k //= 10
if (n % sn == 0):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())
    if (N / (N % 9)) % 1 == 0:
        print("Yes")
    else:
        print("No")
    return 0
main()

Submission status: Runtime Error

Solution code:
N = input()
SN = sum(map(int, list(N)))
print('Yes' if N%SN == 0 else 'No')

Submission status: Runtime Error

Solution code:
n = int(input())
total = 0
for i in range(len(str(n))):
  total += str(n)[i]
if N%total == 0:
  print('Yes')
else:
  print('No')