Problem:


Score : 200 points

Problem Statement

An integer X is called a Harshad number if X is divisible by f(X), where f(X) is the sum of the digits in X when written in base 10.

Given an integer N, determine whether it is a Harshad number.

Constraints

1?N?10^8

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print Yes if N is a Harshad number; print No otherwise.

Sample Input 1

12

Sample Output 1

Yes

f(12)=1+2=3. Since 12 is divisible by 3, 12 is a Harshad number.

Sample Input 2

57

Sample Output 2

No

f(57)=5+7=12. Since 57 is not divisible by 12, 12 is not a Harshad number.

Sample Input 3

148

Sample Output 3

No



Sample input:
12


Sample output:
Yes

Submission status: Accepted

Solution code:

n = input()
a = int(n)
b = sum(map(int,list(n)))
if a % b == 0:
 print("Yes")
else:
 print("No")

Submission status: Accepted

Solution code:
n=input()
f=sum(map(int,list(n)))

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

Submission status: Accepted

Solution code:
def main():
    N = input()

    total = 0
    for i in range(len(N)):
        total+=int(N[i])

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

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = str(input())
f = 0

for i in range(len(n)):
    f += int(n[i])

print('Yes' if int(n)%f==0 else 'No')

Submission status: Accepted

Solution code:
n = int(input())

ans = "Yes" if n%sum(map(int,list(str(n)))) == 0 else "No"
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
fn = 0
for i in str(n):
    fn += int(i)

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

Submission status: Accepted

Solution code:
#80 b-harshad number
n=input()
ans=False
keta=len(n)
fx=0
for i in range(keta):
    fx+=int(n[i])
if int(n)%fx==0:
    ans=True
print("Yes" if ans else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
N = int(input())
x = []
orig_N = N
for i in range(len(str(N))):
    x.append(N % 10)
    N = int(N/10)

print("Yes") if orig_N % sum(x) == 0 else print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def is_harshad_number(x):
    return not x % sum(list(map(int, list(str(n)))))

n = int(sys.stdin.readline().rstrip())

def main():
    return 'Yes' if is_harshad_number(n) else 'No'

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding:utf-8
n = input()
fx = 0
# fxの値を求める(nの各桁の和)
for i in range(0, len(n)):
    fx += int(n[i])

if int(n) % fx == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

n = input()
print("Yes" if int(n) % sum(map(int, n)) == 0 else "No")

Submission status: Accepted

Solution code:
n = int(input())

sum = 0
for i in str(n):
    sum += int(i)

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

Submission status: Accepted

Solution code:
x = input()
fx = sum(list(map(int,list(x))))


if int(x)%fx == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = list(str(input()))

tmp = len(N)
fx = 0
x = 0
for i in range(tmp):
    x += int(N[i]) * 10 ** (tmp - i - 1)
    fx += int(N[i])

if x % fx == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())


def sum_digit(num):
    res = 0
    while num > 0:
        res += int(num % 10)
        num = int(num / 10)
    return res


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

Submission status: Accepted

Solution code:
x=input()
sumd=list(x)
sumd=[int(sumd[i]) for i in range(len(x))]
if int(x)%sum(sumd):
  print("No")
else:
  print("Yes")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N = INT()
if N%sum(map(int, list(str(N)))) == 0:
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
s = input()
sum_of_digits = sum(map(int, s))
if int(s) % sum_of_digits == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
N = int(input())

def ABC080(x):
    ans = 0
    while x/10 != 0:
        ans += x % 10
        x //= 10
    return ans

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n1=input()
n2=int(n1)

c=0
for i in n1:
    c+=int(i)
if n2%c==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n = input()
f = 0
for c in n:
  f += int(c)
print('Yes' if int(n) % f == 0 else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=input()

cnt=0
for i in range(len(N)):
    cnt+=int(N[i])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

N = input()

_sum = sum(int(c) for c in N)
if int(N) % _sum == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = input()
sum_of_digits = sum(map(int, x))
check = int(x) % sum_of_digits
print('No' if check else 'Yes')

Submission status: Accepted

Solution code:
n = int(input())
wa = sum(map(int, list(str(n))))

if n % wa == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
n = int(input())

sum_digit = 0
for i in range(len(str(n))):
    sum_digit += int(str(n)[i])

if n % sum_digit == 0:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
Dip = N
fig = 0
while Dip !=0:
  fig += Dip%10
  Dip = Dip//10

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect, string
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1

def digit_sum(n,base=10):
    result = 0
    while n:
        result += n % base
        n //= base
    return result
n=int(input())
if n%digit_sum(n)==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n = int(input())
amari = 0
for i in range(1,9):
  amari += ((n - n % 10 **(i - 1)) % 10**i)/10**(i-1)
if n % amari == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
#n = int(input())
#n,k = map(int,input().split())
#x = list(map(int,input().split()))

n = input()
a = int(n)

b=list(map(int,list(n)))


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
N = int(n)
I = []

for i in range(len(n)):
    I = I + [int(n[i])]

S = sum(I)

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

Submission status: Accepted

Solution code:
S = input()
B = int(S)


A = list(S)
A_INT = [int(s) for s in A]
A_SUM = sum(A_INT)

Ans = B%A_SUM

if Ans == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N = int(input())

N_digit = list(str(N))
sum_digit = 0
for i in range(len(N_digit)):
    sum_digit += int(N_digit[i])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n0 = int(input())
n = list(str(n0))
a = sum(int(i) for i in n)
if n0%a ==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def findSumDigits(n: int)->int:
    sum_digits = 0
    while n > 0: 
        sum_digits += n % 10
        n //= 10
    return sum_digits
  
N = int(input())
f_x = findSumDigits(N)
if N % f_x == 0: 
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
def digitSum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)
    
n = int(input())
ans = "No"
if n % digitSum(n) == 0:
    ans = "Yes"

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
l=[int(c) for c in str(n)]
f=sum(l)
if n%f==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N = input()
x = int(N)
fx = sum([int(i) for i in N])

if (x%fx == 0):
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
[print("Yes" if not n % sum(map(int, str(n))) else "No") for n in [int(input())]]

Submission status: Accepted

Solution code:
def s(num):
  val=0
  while num>0:
    val+=num%10
    num=num//10
  return val
n=int(input())
if n%s(n)==0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ls_n = [int(_) for _ in list(str(n))]

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

Submission status: Accepted

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

N = int(input())

list_N = list(str(N))
total = 0
for n in list_N:
    total += int(n)

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

Submission status: Accepted

Solution code:
N = int(input())

sum_N = 0
N_tmp = N
while N_tmp > 0:
  sum_N += N_tmp%10
  N_tmp = N_tmp//10

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def digit_sum(n):
    n = str(n)
    S = list(map(int,n))
    return sum(S)

X = int(input())
fX = digit_sum(X)
print("Yes" if X % fX == 0 else "No")

Submission status: Accepted

Solution code:
n = input()
cou = 0

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

Submission status: Accepted

Solution code:
n = int(input())
m = n
num = 0

while m != 0:
    num = num + m % 10
    m = m // 10

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# vim: set fileencoding=utf-8:
import sys
from collections import Counter
input = sys.stdin.readline

"""
H = int(input())
h = [int(ele) for ele in input().split()]
h = [0] + h
"""


def main():
    N = input()
    ct = Counter(N)
    s = 0
    for num, count in zip(ct.keys(), ct.values()):
        if str(num) in '123456789':
            s += int(num) * int(count)

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


def bfs(queue):
    global yet, graph
    if len(queue) == 0:
        return
    yet.remove(queue[-1])

    for i, adjacency in enumerate(graph[queue[-1]]):
        if adjacency == 1 and (i in yet) and (i not in queue):  # 隣接かつ未探索であれば、stackにpush
            queue.appendleft(i)
    else:
        queue.pop()
        bfs(queue)


def dfs(stack):
    global yet, graph
    yet.remove(stack[-1])

    for i, adjacency in enumerate(graph[stack[-1]]):
        if adjacency == 1 and i in yet:  # 隣接かつ未探索であれば、stackにpush
            stack.append(i)
            dfs(stack)
    else:
        stack.pop()


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
        if i != n // i:
            divisors.append(n//i)
    return divisors


class Node():

    def __init__(self):
        self.idx = None
        self.left = None
        self.right = None
        self.parent = None
        return

    def pre_order(self):
        global pre_order_str
        pre_order_str += str(self.idx) + " "
        if self.left:
            self.left.pre_order()

        if self.right:
            self.right.pre_order()

    def in_order(self):
        global in_order_str

        if self.left:
            self.left.in_order()

        in_order_str += str(self.idx) + " "

        if self.right:
            self.right.in_order()

    def post_order(self):
        global post_order_str
        if self.left:
            self.left.post_order()

        if self.right:
            self.right.post_order()

        post_order_str += str(self.idx) + " "


class HeapHelper():
    """HeapContrler.
    完全二分木を二分ヒープで表現した配列 A に対して、
    HeapHelper.parent(idx) とするとそのノードの親の添字を返す
    存在しない場合は Falseを返す

    Returns:
        [type] -- [description]
    """

    def __init__(self):
        return

    @staticmethod
    def parent(i):
        if i == 1:
            return False

        return int(i/2)

    @staticmethod
    def left(i):
        l_idx = 2*i
        if H < l_idx:
            return False

        return l_idx

    @staticmethod
    def right(i):
        r_idx = 2*i + 1
        if H < r_idx:
            return False

        return r_idx


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = input()
h = 0
for c in n:
  h += int(c)
if int(n) % h == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
sum = 0
M = N
while M != 0:
     sum += M % 10
     M = M // 10

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

Submission status: Accepted

Solution code:
n = int(input())
m = list(str(n))

mm = sum([int(i)for i in m])

if n % mm == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
x = input()

fx = sum([int(i) for i in x])

if int(x) % fx == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N = int(input())

S = list(str(N))

ADD = 0
for i in S:
    ADD += int(i)

if N % ADD == 0:
    print('Yes')

else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

N = input()
l = list(map(int,N))

f = sum(l)
flag = 0

if int(N) % f == 0:
    flag = 1

if flag == 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
n = input()
x = 0
for i in n:
        x += int(i)
print('YNeos'[int(n) % x != 0::2])

Submission status: Accepted

Solution code:
def digit10(x):
    dten = 0
    while(x>0):
        dten+=int(x%10)
        x/=10
    return dten

n = int(input())
if n%digit10(n)==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
##### 解けた #####

N=input()
Nd=int(N) # 10進数
fn=sum(list(map(int,list(N)))) # 各桁の和

if Nd%fn==0: # ハーシャッド数の場合
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N = I()
    D_sum = sum((int(i) for i in str(N)))
    print("YNeos"[N%D_sum!=0::2])
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def calc_digit_sum(num):
    x = num
    digit_sum = 0

    while x > 0:
        digit_sum += x % 10
        x //= 10

    return digit_sum

N = int(input())

if N % calc_digit_sum(N) == 0:
    is_harshad_number = "Yes"
else:
    is_harshad_number = "No"

print(is_harshad_number)

Submission status: Accepted

Solution code:
n=input()
int_n=int(n)
l=[int(i) for i in n]
s=sum(l)
if int_n%s==0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
def calculate(n):
    ans = 0
    for i in range(len(str(n))):
        ans += n % 10
        n //= 10
    return ans


n = int(input())
if n % calculate(n) == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
Sn = input()
n = int(Sn)
def f(n):
    r = 0
    for i in n:
        r += int(i)
    return r

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

Submission status: Accepted

Solution code:
n = input()

n_sum = 0

for i in range(len(n)):
    n_sum += int(n[i])

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

Submission status: Accepted

Solution code:
N = int(input())
n = sum(list(map(int, str(N))))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    s=input()
    x=int(s)
    fx=sum(int(c) for c in s)
    print("No") if x%fx else print("Yes")

main()

Submission status: Accepted

Solution code:
n = int(input())

sum = 0
k = n

while n > 0:
	sum = sum + n % 10
	n = n//10
	
#print(sum)

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

Submission status: Accepted

Solution code:
n = input()
a = int(n)
b = sum(int(i) for i in n)
if a%b==0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
from sys import stdin
from itertools import groupby

n = int(stdin.readline().rstrip())

s = str(n)

point = 0
for i in s:
    point += int(i)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
j = n
sum = 0
while j > 0:
  sum += j % 10
  j = j // 10
if n % sum == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
n = int(input())

def ds(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)
flag = n % ds(n) == 0

if flag:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
n = input()
ni = int(n)
f = 0
for ns in n:
  f += int(ns)
if ni % f == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

def F(x):
  if x < 10:
    return x
  return x%10 + F(x//10)

answer = 'Yes' if N%F(N) == 0 else 'No'
print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def examB():
    X = S()
    sumS = 0
    for i in X:
        sumS += int(i)
    judge = int(X)%sumS
    if judge==0:
        ans = "Yes"
    else:
        ans = "No"
    print(ans)

import sys,copy,bisect,itertools
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
X_ = X
x_sum = 0
while True:
    x_sum += X_ % 10
    if (X_ // 10) ==0 :
        break
    else:
        X_ = X_ // 10
if X % x_sum == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
N=input()
f=[int(_) for _ in N]
x=sum(f)

print("No" if int(N)%x else "Yes")

Submission status: Accepted

Solution code:
def isHarshad(x):
  n = int(x)
  c = 0
  for i in x:
    c += int(i)
  if n%c==0:
    return True
  return False

if isHarshad(input()):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
n=int(input())
f=0
n_s=str(n)
x=0
for i in n_s:
    x+=int(i)
print('Yes' if n%x==0 else 'No')

Submission status: Accepted

Solution code:
n = input()
x = int(n)
f = sum(map(int, list(n)))

# print(n, x, f)

print("Yes" if x % f == 0 else "No")

Submission status: Accepted

Solution code:
#080b
N = str(input())

fx = 0
for number in N:
    fx += int(number)
    
if int(N)%fx == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def main():
  s = input()
  num = 0
  for i in list(s):
    num += int(i)
  N = int(s)
  print('Yes' if N % num == 0 else 'No')

main()

Submission status: Accepted

Solution code:
N=int(input())
N_str=list(str(N))
N_int=[int(i) for i in N_str]
N_harsh=N%sum(N_int)

if N_harsh==0:print('Yes')
else:print('No')

Submission status: Accepted

Solution code:
# ABC 080: B – Harshad Number
n = input()
sum_of_digits = 0

for digit in n:
    sum_of_digits += int(digit)

print('Yes' if int(n) % sum_of_digits == 0 else 'No')

Submission status: Accepted

Solution code:
n = (input())
f = 0
for i in n:
    f += int(i)
    
n = int(n)

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

Submission status: Accepted

Solution code:
N = int(input())

def f(n):
    res = 0
    for i in range(len(str(n))):
        res += (n//10**i)%10
    return res

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

Submission status: Accepted

Solution code:
x = input()
sum_of_x = sum([int(x) for x in x])
x = int(x)
print('No' if x%sum_of_x else 'Yes')

Submission status: Accepted

Solution code:
N = input()
lst = [int(N[i]) for i in range(len(N))]

if (int(N) % sum(lst)) == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())


def Harshad(N):
  pro = 0
  N_list = list(str(N))
  for i in range(len(N_list)):
    pro += int(N_list[i])
  return pro

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

def digitSum(n):
  s = str(n)
  array = list(map(int, s))
  return sum(array)

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

Submission status: Accepted

Solution code:
n = input()
cnt = 0

for i in n:
    i = int(i)
    cnt += i

print('Yes' if int(n) % cnt == 0 else 'No')

Submission status: Accepted

Solution code:
n = int(input())
n_list = list(str(n))
n_list = [int(i) for i in n_list]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

math = 0
for i in str(N):
    math = math + int(i)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
w=n
s=0
while w>0:
  s+=w%10
  w//=10
print(("No","Yes")[n%s==0])

Submission status: Accepted

Solution code:
import sys
# read = sys.stdin.read
readline = sys.stdin.readline
# readlines = sys.stdin.readlines
# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics

def main():
    n = readline().rstrip()
    digits = [int(d) for d in n]
    print('Yes' if int(n) % sum(digits) == 0 else 'No')

if __name__ == "__main__":
    # execute only if run as a script
    main()

Submission status: Accepted

Solution code:
N = int(input())

def f(x):
    res = 0
    while x > 0:
        res += x % 10
        x //= 10
    return res
if N % f(N) == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

n_digit = list(str(n))

harshad = 0
for i in range(len(n_digit)):
    harshad += int(n_digit[i])

if n % harshad == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
N=int(input())
f=str(N)
F=list(f)
fx=0

for i in range(len(F)):
  fx+=int(F[i])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
append_list = []
for i in range(len(N)):
  append_list.append(int(N[i]))
if int(N) % sum(append_list) == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

a=n
f=0

while a//10 != 0:
    f +=(a%10)
    a //=10

if n%(f+a)==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()
N=int(n)
S=N
ans=0
for i in range(0,9):
  if N//(10**(8-i)) !=0:
    a=N//(10**(8-i))
    ans+=N//(10**(8-i))
    N-=a*(10**(8-i))
if int(S/ans)==S/ans:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
n=input()
N=int(n)
d=list(n)
for i in range(len(d)):
  d[i]=int(d[i])
x=sum(d)

if int(N/x)==(N/x):
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = input()[: -1]
f = sum(list(map(int, list(N))))
if int(N) % f == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

x = 0
m = n

while n > 1 :
    x += n % 10
    n = int(n / 10)

if m % (n + x) == 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

sumn = sum(list(map(int,str(n))))
if n%sumn == 0:
	print('Yes')
else:
	print('No')

Submission status: Accepted

Solution code:
N = int(input())

# 各位の値を足し算する処理
def sum_each_digit(n):
    total = 0
    while n > 0:
        total += n % 10
        n //= 10
    return total


if N % sum_each_digit(N) == 0:
    result = 'Yes'
else:
    result = 'No'

print(result)

Submission status: Accepted

Solution code:
n = int(input())

tmp = n
digitSum = 0
while tmp:
    digitSum += tmp % 10
    tmp //= 10
if n % digitSum == 0:
    print('Yes')
else:
    print('No')