input
stringlengths
20
127k
target
stringlengths
20
119k
problem_id
stringlengths
6
6
N = int(eval(input())) a_list = list(map(int, input().split())) #偶数のaだけ取り出す a_even = [] for a in a_list: if a % 2 == 0: a_even.append(a) times = 0 while len(a_even) > 0: a_even[0] /= 2 times += 1 if a_even[0] % 2 == 1: a_even.pop(0) else: a = [a_even[0]] + [i*2 for i in a_even[1:]] p...
N = int(eval(input())) a_list = list(map(int, input().split())) #偶数のaだけ取り出す a_even = [] for a in a_list: if a % 2 == 0: a_even.append(a) times = 0 while len(a_even) > 0: a_even[0] /= 2 times += 1 if a_even[0] % 2 == 1: a_even.pop(0) print(times)
p03325
N = int(eval(input())) A = list(map(int, input().split())) num_list = [] cnt = 0 while True: even_count = 0 #print(A) if not "even" in list(["even" if x % 2 == 0 else "odd" for x in A]): break for index, num in enumerate(A): if not even_count == 1 and num % 2 == 0: ...
N = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for num in range(N): while A[num] % 2 ==0: cnt += 1 A[num] //= 2 print(cnt)
p03325
from collections import Counter def prime_factorize(n): a = [] while n % 2 == 0: a.append(2) n //= 2 f = 3 while f * f <= n: if n % f == 0: a.append(f) n //= f else: f += 2 if n != 1: a.append(n) return a ...
n = int(eval(input())) ali = list(map(int, input().split())) total = 0 for a in ali: while a%2==0: a = (a//2) total += 1 print(total)
p03325
import math def q77(N, a): i = 0 o = 0 while True: b = False for j in range(o, N): a[j] = a[j]/2 if a[j].is_integer(): i += 1 b = True break else: o = j if not b: ...
def q77(N, a): i = 0 for b in a: while True: b = b/2 if not b.is_integer(): break else: i += 1 return i N = int(eval(input())) a = [int(i) for i in input().split()] print((q77(N, a)))
p03325
n = int(eval(input())) l = list(map(int, input().split())) ans = 0 flag = 1 i = 1 while flag: y = 2**i m = list([x%y for x in l]) if 0 in m: ans += m.count(0) i += 1 else: flag = 0 print(ans)
n = int(eval(input())) A = list(map(int, input().split())) ans = 0 for i in range(n): a = A[i] ans += format(a, 'b')[::-1].find('1') print(ans)
p03325
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 while True: if all(i%2==1 for i in a): break ans += 1 t = 0 for i in range(n): if a[i]%2 == 1: a[i] *= 3 else: if t == 0 and a[i] != 2: a[i] //= 2 t += 1 else: a[i] *= 3 print(ans)
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 for i in a: while i%2==0: i//=2 ans+= 1 print(ans)
p03325
n = int(eval(input())) a = sorted(list(map(int, input().split()))) ans = 0 t = 1 while t != 0: t = 0 for i in range(n-1, -1 ,-1): if t == 0 and a[i]%2 == 0 and a[i] != 2: a[i] //= 2 t += 1 ans += 1 else: a[i] *= 3 print(ans)
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 for i in a: while i%2==0: i //= 2 ans += 1 print(ans)
p03325
n = int(eval(input())) a = sorted(list(map(int, input().split()))) ans = 0 flag = True while flag: flag = False for i in range(n-1, -1, -1): if not flag and a[i]%2 == 0: flag = True ans += 1 a[i] //= 2 else: a[i] *= 3 print(ans)
n = int(eval(input())) a = sorted(list(map(int, input().split()))) ans = 0 for i in a: if i%2 == 0: while i%2 == 0: ans += 1 i //= 2 print(ans)
p03325
N = int(eval(input())) A = list(map(int,input().split())) ans = 0 for i in range(N): while A[i]%2 == 0: ans += 1 A[i] = A[i]//2 print(ans)
N = int(eval(input())) A = list(map(int,input().split())) Flag = True for x in A: if x%2 != 1: Flag = False break if Flag: print((0)) exit() ans = 0 for x in A: while x%2 == 0: ans += 1 x = x//2 print(ans)
p03325
n=int(eval(input())) #a,b=map(int,input().split()) al=list(map(int,input().split())) #l=[list(map(int,input().split())) for i in range(n)] count=0 for a in al: temp=0 v=a while v%2==0: v=v//2 temp+=1 count+=temp print(count)
n=int(eval(input())) #a,b,n=map(int,input().split()) al=list(map(int,input().split())) #l=[list(map(int,input().split())) for i in range(n)] def div2(v): res=0 if v==0: return res while v%2==0: v=v//2 res+=1 return res ans=0 for ai in al: ans+=div2(ai) print(...
p03325
# -*- coding: utf-8 -*- # AtCoder Beginner Contest if __name__ == '__main__': n = int(eval(input())) a = list(map(int, input().split())) count = 0 # See: # https://beta.atcoder.jp/contests/abc100/submissions/2675457 for ai in a: while ai % 2 == 0: ai //= 2 ...
# -*- coding: utf-8 -*- def main(): n = int(eval(input())) a = list(map(int, input().split())) ans = 0 for ai in a: while ai % 2 == 0: ans += 1 ai = ai // 2 print(ans) if __name__ == '__main__': main()
p03325
n = int(eval(input())) nums = [int(i) for i in input().split()] count = 0 while any([i % 2 == 0 for i in nums]): count += 1 div_index = max([(i, v) for i, v in enumerate(nums) if v % 2 == 0], key=lambda x: x[1])[0] for i in range(len(nums)): if i == div_index: ...
n = int(eval(input())) nums = [int(i) for i in input().split()] tmp = [i for i in nums if i % 2 == 0] count = 0 for i in tmp: while i % 2 == 0: count += 1 i //= 2 print(count)
p03325
N=int(eval(input())) A=list(map(int,input().split())) def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) i...
N=int(eval(input())) A=list(map(int,input().split())) def factorization(n): arr = [] temp = n i=2 if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]: ...
p03325
N = int(eval(input())) a = list(map(int, input().split())) ans = 0 for x in a: if x % 2 == 0: cnt = 0 while x % 2 == 0: x //= 2 cnt += 1 ans += cnt print(ans)
n = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for a in A: if a%2==0: while a%2==0: a //= 2 cnt += 1 print(cnt)
p03325
n, *a = list(map(int, open(0).read().split())) ans = 0 for i in a: cnt = 0 while i%2==0: i //= 2 cnt += 1 ans += cnt print(ans)
n, *a = list(map(int, open(0).read().split())) ans = 0 for i in a: while i%2==0: i //= 2 ans += 1 print(ans)
p03325
N = int(eval(input())) a = list(map(int, input().split())) ans = 0 m = 1 for i in a: m *= i while True: if m % 2 == 0: ans += 1 m //= 2 else: break print(ans)
N = int(eval(input())) a = list(map(int, input().split())) ans = 0 for i in a: count = 0 while True: if i % 2**(count+1) == 0: count += 1 else: ans += count break print(ans)
p03325
n = int(eval(input())) li = list(map(int,input().split())) li = [x for x in li if x%2 ==0] li2 = [] for i in range(len(li)): num = 0 while li[i]%2 == 0: li[i] = li[i]/2 num += 1 li2.append(num) print((sum(li2)))
n = int(eval(input())) L = list(map(int,input().split())) ans = 0 for i in range(n): cnt = 0 while True: if L[i]%2 == 0: cnt +=1 L[i]//=2 else: break ans +=cnt print(ans)
p03325
# author: kagemeka # created: 2019-11-08 12:38:16(JST) ## internal modules import sys # import collections import math # import string # import bisect # import re # import itertools # import statistics # import functools # import operator ## external module...
# author: kagemeka # created: 2019-11-08 12:38:16(JST) ## internal modules import sys # import collections import math # import string # import bisect # import re # import itertools # import statistics # import functools # import operator ## external module...
p03325
# author: kagemeka # created: 2019-11-08 12:38:16(JST) ## internal modules import sys # import collections import math # import string # import bisect # import re # import itertools # import statistics # import functools # import operator ## external module...
import sys n, *a = list(map(int, sys.stdin.read().split())) def main(): cnt = 0 for i in a: while not i % 2: i //= 2 cnt += 1 return cnt if __name__ == '__main__': ans = main() print(ans)
p03325
n=int(eval(input())) A=list(map(int,input().split())) count=0 flag=False while any(a%2==0 for a in A): count+=1 flag=False for i in range(n): if A[i]%2==0 and flag==False: A[i]//=2 flag=True else: A[i]*=3 print(count)
n=int(eval(input())) A=list(map(int,input().split())) ans=0 for i in A: while i%2==0: i//=2 ans+=1 print(ans)
p03325
n = int(eval(input())) A = list(map(int,input().split())) count = 0 for a in A: while a%2 == 0: count += 1 a /= 2 print(count)
n = int(eval(input())) A = list(map(int,input().split())) cnt = 0 for a in A: while a%2 == 0: cnt += 1 a /= 2 print(cnt)
p03325
n = int(eval(input())) A = list(map(int,input().split())) cnt = 0 for a in A: while a%2 == 0: cnt += 1 a /= 2 print(cnt)
N = int(eval(input())) A = list(map(int,input().split())) res = 0 for a in A: while a%2 == 0: a //= 2 res += 1 print(res)
p03325
N = int(eval(input())) A = list(map(int,input().split())) res = 0 for a in A: while a%2 == 0: res += 1 a //= 2 print(res)
n = int(eval(input())) A = list(map(int,input().split())) res = 0 for a in A: while a%2 == 0: res += 1 a //= 2 print(res)
p03325
n = int(eval(input())) a = [int(i) for i in input().split()] b = 0 c = 0 cnt = 0 flag = False while True: b = 0 c = 0 for i in range(n): if a[i] % 2 == 0 and c == 0: a[i] /= 2 c += 1 else: b += 1 #print(a,b) if b != n: cn...
n = int(eval(input())) a = [int(i) for i in input().split()] ''' b = 0 c = 0 cnt = 0 flag = False while True: b = 0 c = 0 for i in range(n): if a[i] % 2 == 0 and c == 0: a[i] /= 2 c += 1 else: b += 1 #print(a,b) if b != n: ...
p03325
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 while True: flag = False for i in range(N): if not flag and A[i] % 2 == 0: A[i] = A[i] // 2 flag = True else: A[i] *= 3 if flag: ans += 1 else: break prin...
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for i in range(N): while True: if A[i] % 2 == 0: ans += 1 A[i] = A[i] // 2 else: break print(ans)
p03325
def main(): N = int(eval(input())) A = [int(i) for i in input().split()] def count_div_by2(num): cnt = 0 while num%2 == 0: cnt += 1 num //= 2 return cnt print((sum(count_div_by2(n) for n in A))) if __name__ == '__main__': main()
def main(): N = int(eval(input())) A = [int(i) for i in input().split()] ans = 0 for i in range(N): while A[i] % 2 == 0: ans += 1 A[i] //= 2 print(ans) if __name__ == '__main__': main()
p03325
N = int(eval(input())) a = list(map(int, input().split())) ans = 0 for i in range(N): ans += format(a[i], 'b')[::-1].find('1') print(ans)
int(eval(input())) print((sum([format(int(a), "b")[::-1].index("1") for a in input().split()])))
p03325
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for _ in range(30): ans += sum([(a - 1) % 2 for a in A]) A = [a // 2 for a in A if a % 2 == 0] print(ans)
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for a in A: while a % 2 == 0: ans += 1 a //= 2 print(ans)
p03325
from functools import reduce _ = eval(input()) even = reduce(lambda x, y: x * y, list(map(int, input().split()))) i = 0 while even % 2 == 0: i = i + 1 even = even // 2 print(i)
_ = eval(input()) even = [int(i) for i in input().split() if int(i) % 2 == 0] i = 0 while len(even) != 0: i = i + len(even) even = [i // 2 for i in even if (i // 2) % 2 == 0] print(i)
p03325
n=int(eval(input())) a=list(map(int, input().split())) cnt=0 while any(a[i]%2==0 for i in range(n)): m=0 for j in range(n): if a[j]%2==0: if a[j]>m: m=a[j] index=j for k in range(n): a[k]*=3 a[index]=a[index]//6 cnt+=...
n=int(eval(input())) a=list(map(int, input().split())) even_num=[0]*n for i in range(n): cnt=0 if a[i]%2==0: while a[i]%2==0: a[i]=a[i]/2 cnt+=1 even_num[i]=cnt ans=sum(even_num) print(ans)
p03325
N = int(eval(input())) aList = [int(x) for x in input().split()] # 2で割るor3倍にする # 全部3倍はダメで、操作後は整数でないとダメ。 en = aList count = 0 while True: cache = [] for x in en: if x % 2 == 0: if len(cache) > 0: cache.append(int(3*x)) else: cache.a...
N = int(eval(input())) aList = [int(x) for x in input().split()] def calc(x, cache): if x % 2 == 0: return calc(x//2, cache+1) else: return cache count = 0 for x in aList: if x % 2 == 0: count += calc(x, 0) print(count)
p03325
n = int(eval(input())) list=list(map(int,input().split())) count=0 for i in range(n): while list[i]%2==0: list[i]=list[i]/2 count+=1 print(count)
n = int(eval(input())) list=list(map(int,input().split())) count=0 for i in range(n): while list[i]%2==0: list[i]=list[i]//2 count+=1 print(count)
p03325
from math import log2 n = int(eval(input())) a = list(map(int, input().split())) ans = 0 for _a in a: if _a%2 == 0: cnt =0 while _a%2 == 0: _a //= 2 cnt += 1 ans += cnt print((int(ans)))
def f(k): cnt = 0 while k%2 == 0: k //= 2 cnt += 1 # print(k) # print("-----") return cnt n = int(eval(input())) A = list(map(int, input().split())) ans = 0 for a in A: if a%2 == 0: ans += f(a) print(ans)
p03325
n = int(eval(input())) a = list(map(int,input().split())) t = 0 while True: a.sort(reverse = True) x = True for i in range(n): if a[i] % 2 == 0: if x: a[i] = a[i] // 2 x = False if x: print(t) exit(0) else: ...
n = int(eval(input())) a = list(map(int,input().split())) t = 0 for i in range(n): while a[i] % 2 == 0: a[i] = a[i] // 2 t += 1 print(t)
p03325
def main(): N = int(eval(input())) an = list(map(int, input().split())) ans = 0 for a in an: if a % 2 != 0: continue while True: if a % 2 != 0: break a //= 2 ans += 1 print(ans) main()
def main(): N = int(eval(input())) an = list(map(int, input().split())) ans = 0 for a in an: while True: if a % 2 != 0: break a //= 2 ans += 1 print(ans) main()
p03325
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 def d(ai,ans): if ai % 2 != 0: return ans ans += 1 return d(ai / 2, ans) for ai in a: ans=d(ai,ans) print(ans)
N=int(eval(input())) A=list(map(int,input().split())) count=0 for a in A: while a%2==0: count+=1 a//=2 print(count)
p03325
import operator as o import functools as f n,*a=list(map(int,open(0).read().split())) #print(f.reduce(o.mul,a)) x=f.reduce(o.mul,a) count=0 while True: if x%2==0: x=x//2 count+=1 else: break print(count)
n,*a=list(map(int,open(0).read().split())) #print(f.reduce(o.mul,a)) a=[s for s in a if s%2==0] if len(a)==0: print((0)) exit() count=0 for x in a: while True: if x%2==0: x=x//2 count+=1 else: break print(count)
p03325
n,*a=list(map(int,open(0).read().split())) #print(f.reduce(o.mul,a)) a=[s for s in a if s%2==0] if len(a)==0: print((0)) exit() count=0 for x in a: while True: if x%2==0: x=x//2 count+=1 else: break print(count)
n,*a=list(map(int,open(0).read().split())) def f(x): ans=0 while x%2==0 : ans+=1 x//=2 return ans print((sum(map(f,a))))
p03325
n=int(eval(input())) def prime_factors(n): i = 2 factors = [] while i * i <= n: if n % i==0: n //= i factors.append(i) else: i += 1 if n > 1: factors.append(n) return factors A=list([prime_factors(x).count(2) if x%2==0 else 0 for x in list(map(int,input().split()))...
flag=True n=int(eval(input())) A=list(map(int,input().split())) cnt=0 while flag: ls=[] tmp=False for a in A: if a%2==0: tmp=True cnt+=1 ls.append(a//2) A=ls if tmp==False: flag=False print(cnt)
p03325
N = eval(input()) a = list(map(int, input().split())) c = 0 while True: gusu = False for i, aa in enumerate(a): if gusu is False and a[i] % 2 == 0: a[i] /= 2 gusu = True continue if gusu is False: break c += 1 print(c)
N = eval(input()) a = list(map(int, input().split())) c = 0 for i, aa in enumerate(a): while a[i] % 2 == 0: a[i] /= 2 c += 1 print(c)
p03325
# https://abc100.contest.atcoder.jp/tasks/abc100_c def get_primes_dic(v): m = {} i = 2 while i <= v: while v % i == 0: if i in m: m[i] += 1 else: m[i] = 1 v //= i i += 1 return m N = int(eval(i...
# https://abc100.contest.atcoder.jp/tasks/abc100_c def even_count(v): if v % 2 != 0: return 0 else: r = 0 while v % (2 ** 20) == 0: r += 20 v //= (2 ** 20) while v % (2 ** 10) == 0: r += 10 v //= (2 ** 10) ...
p03325
def factorize2(n): """ nの値を素因数分解し、素因数とその指数をtupleにまとめたリストを返す e.g. >>> factorize(20) [(2, 2), (5, 1)] """ b = 2 fct = [] while b * b <= n: cnt = 0 while n % b == 0: cnt += 1 n //= b if cnt > 0: fct.append((b, cn...
def factorize2(n): """ nの値を素因数分解し、素因数とその指数をtupleにまとめたリストを返す e.g. >>> factorize(20) [(2, 2), (5, 1)] """ b = 2 fct = [] while b == 2: cnt = 0 while n % b == 0: cnt += 1 n //= b if cnt > 0: fct.append((b, cnt)) ...
p03325
n = int(eval(input())) a = list(map(int, input().split())) s = 0 while True: divided = False for i in range(n): if a[i] % 2 == 0: a[i] //= 2 divided = True break if divided: s += 1 else: break print(s)
n = int(eval(input())) a = list(map(int, input().split())) s = 0 for i in range(n): while a[i] % 2 == 0: a[i] //= 2 s += 1 print(s)
p03325
n = int(eval(input())) A = list(map(int, input().split())) ans = 0 waru = 0 cnt = 0 while True: for i in range(n): if A[i] % 2 == 0: if waru == 1: A[i] *= 3 else: A[i] //= 2 waru = 1 else: A[i] *= 3...
n = int(eval(input())) A = list(map(int, input().split())) ans = 0 for a in A: while a % 2 == 0: a /= 2 ans += 1 print(ans)
p03325
import math n = int(eval(input())) a = sorted(list(map(int, input().split()))) aMax, aNum, aMaxSum = 0, 0, 0 for i in range(n): aNum, aCnt = a[i], 0 while aNum % 2 == 0 and aNum / 2 == aNum // 2: aCnt += 1 aNum /= 2 aMaxSum += aCnt print(aMaxSum)
n = int(eval(input())) a = list(map(int, input().split())) aMax, aCnt = 0, 0 for i in range(n): while a[i] % 2 == 0: aCnt += 1 a[i] /= 2 print(aCnt)
p03325
N = int(eval(input())) A = list(map(int, input().split())) def prime_factor(n): i = 2 table = [] while i * i <= n: while n % i == 0: n //= i table.append(i) i += 1 if n > 1: table.append(n) return table ans = 0 for i in range(N): ...
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for i in range(N): while True: if A[i]%2 == 0: ans += 1 A[i] = A[i] // 2 else: break print(ans)
p03325
import functools N = int(eval(input())) A = [int(x) for x in input().split()] P = functools.reduce(lambda a,b: a*b, A) print((len(bin(P).split('1')[-1])))
N = int(eval(input())) k = 0 for a in map(int, input().split()): while a % 2 == 0: k += 1 a //= 2 print(k)
p03325
# -*- coding: utf-8 -*- # 標準入力を取得 N = int(eval(input())) a = list(map(int, input().split())) # 求解処理 def get_divisible_count(x: int) -> int: divisible_count = 0 while x % 2 == 0: divisible_count += 1 x /= 2 return divisible_count ans = 0 for n in range(N): ans += ge...
# -*- coding: utf-8 -*- def get_input() -> tuple: """ 標準入力を取得する. Returns:\n tuple: 標準入力 """ N = int(eval(input())) a = list(map(int, input().split())) return N, a def get_divisible_count(x: int) -> int: """ 2で何回割ることができるかを返す. Args:\n x (in...
p03325
def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp % i == 0: cnt = 0 while temp % i == 0: cnt += 1 temp //= i arr.append([i, cnt]) if temp != 1: arr.append([temp, 1]) ...
if __name__ == "__main__": n = int(eval(input())) a = list(map(int, input().split())) ans = 0 for i in range(n): ans += format(a[i], 'b')[::-1].find('1') print(ans)
p03325
n = int(eval(input())) lists = list(map(int,input().split())) count = 0 old = 0 while(True): for i in range(n): if(lists[i] % 2 ==0): lists[i] = lists[i]/2 count+=1 else : lists[i] = lists[i]*3 if(count == old): break old = count prin...
n = int(eval(input())) lists = list(map(int,input().split())) count = 0 for i in range(n): if(lists[i] % 2 ==0): while(True): if(lists[i] % 2 ==0): lists[i] = lists[i]/2 count+=1 else : break print(count)
p03325
N = int(eval(input())) A = [int(a) for a in input().split()] def soinsuubunkai(N): num_ = N list_ = [] for k in range(2, N+1): while True: if num_ % k == 0: list_.append(k) num_ = num_ // k else: break return...
N = int(eval(input())) A = [int(a) for a in input().split()] counter = 0 for a in A: tmp = a while True: if tmp == 0: break elif tmp % 2 == 0: counter += 1 tmp = tmp // 2 else: break print(counter)
p03325
n=int(eval(input())) A=list(map(int,input().split())) cnt=0 def f(x): tmp=0 while x%2==0: tmp+=1 x=x/2 return tmp for i in range(n): cnt+=f(A[i]) print(cnt)
n=int(eval(input())) A=list(map(int,input().split())) cnt=0 for a in A: while a%2==0: a//=2 cnt+=1 print(cnt)
p03325
n=int(eval(input())) a=list(map(int,input().split())) ans=0 for _ in range(2*(10**4)): count=0 for i in range(n): if a[i]%2!=0: a[i]*=3 count+=1 else: a[i]=a[i]//2 break if count==n: break if count!=n: ans+=...
n=int(eval(input())) a=list(map(int,input().split())) b=[] for i in range(1,30): b.append(2**i) #print(b) ans=0 u=len(b) for i in range(n): for j in range(u): if a[i]%b[j]==0: ans+=1 print(ans)
p03325
n = int(eval(input())) a = list(map(int, input().split())) res = 0 for i in range(n): if a[i] % 2 == 0: k = a[i] while k % 2 == 0: k //= 2 res += 1 print(res)
import sys sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n = int(eval(input())) A = list(map(int, input().split())) even = [A[i] for i in range(n) if A[i] % 2 == 0] res = 0 for number in even: while number % 2 == 0: res ...
p03325
N=int(eval(input())) a=list(map(int,input().split())) sum_val=0 for i in range(N): while a[i]%2==0: a[i]//=2 sum_val+=1 print(sum_val)
import sys def input(): return sys.stdin.readline().rstrip() N=int(eval(input())) a=list(map(int,input().split())) ans=0 for i in range(N): tmp=0 while a[i]%2==0: tmp+=1 a[i]//=2 ans+=tmp print(ans)
p03325
#!/usr/bin/env python3 import sys def input(): return sys.stdin.readline()[:-1] def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i ...
#!/usr/bin/env python3 import sys def input(): return sys.stdin.readline()[:-1] def main(): N = int(eval(input())) a = list(map(int, input().split())) ans = 0 for i in range(N): while a[i] % 2 == 0: a[i] = a[i] // 2 ans += 1 print(ans) if __name...
p03325
n = int(eval(input())) a = list(map(int, input().split())) cnt = 0 for i in range(n): while a[i] % 2 == 0: cnt += 1 a[i] /= 2 print(cnt)
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 for i in range(len(a)): tmp = a[i] while tmp % 2 == 0: ans += 1 tmp /= 2 print(ans)
p03325
n = int(eval(input())) a = list(map(int,input().split())) count = 0 for j in range(n): if a[j]%2 == 0: arr = [] temp = a[j] for i in range(2, int(-(-a[j]**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i ...
n = int(eval(input())) a = list(map(int,input().split())) ans = 0 for i in range(n): count = 0 temp = a[i] while (temp%2 == 0): temp = temp//2 count = count + 1 ans = ans + count print(ans)
p03325
if __name__ == '__main__': eval(input()) A = list(map(int,input().split())) cnt = 0 EVE = [i for i in A if i % 2 == 0] EVE.sort() while True: if len(EVE) == 0: print(cnt) break else: EVE[-1] = EVE[-1] // 2 if EVE[-1] % 2 == 1: EVE.pop(-1) else: EVE.sort() cnt += 1...
import sys if __name__ == '__main__': eval(input()) A = list(map(int,sys.stdin.readline().split())) cnt = 0 EVE = [i for i in A if i % 2 == 0] for j in EVE: while True: j = j // 2 if j % 2 == 1: cnt += 1 break cnt += 1 print(cnt)
p03325
N = int(eval(input())) lis = list(map(int,input().split())) S = lis[0] for i in range(2,N+1): S *= lis[i-1] cnt = 0 while S % 2 == 0: S = S//2 cnt += 1 print(cnt)
N = int(eval(input())) lis = list(map(int,input().split())) cnt = 0 for i in range(N): while lis[i] % 2 == 0: lis[i] = lis[i]//2 cnt += 1 print(cnt)
p03325
# -*- coding: utf-8 -*- N = int(input().strip()) a_list = list(map(int, input().rstrip().split())) #----- a_list.sort(reverse=True) Flag=True cnt=0 while Flag: even_flag=False for i in range(len(a_list)): if a_list[i] % 2 == 1: #a_list[i] *= 3 pass ...
# -*- coding: utf-8 -*- N = int(input().strip()) a_list = list(map(int, input().rstrip().split())) #----- a_even_list=[] for v in a_list: if v%2 == 0 and v != 0: a_even_list.append(v) cnt=0 for v in a_list: while v%2 == 0 and v != 0: v /= 2 cnt += 1 print(cnt)
p03325
n = int(eval(input())) a = [int(x) for x in input().split()] ans = 0 while (1): b = [x % 2 for x in a] if (0 not in b): break c = b.index(0) a = [int(a[i]/2) if i == c else a[i] for i in range(n)] ans += 1 print(ans)
n = int(eval(input())) a = [int(x) for x in input().split()] ans = 0 while (1): b = [x % 2 for x in a] ans += b.count(0) if (0 not in b): break a = [int(a[i]/2) if b[i]==0 else a[i] for i in range(n)] print(ans)
p03325
N = int(eval(input())) array = list(map(int,input().split(" "))) i = 0 count = 0 while i < N: if array[i]%2 == 0: array[i] = array[i]/2 count+=1 else: i+=1 print(count)
N=int(eval(input())) a=list(map(int,input().split())) count=0 for i in range(N): while a[i]%2==0: a[i]=int(a[i]/2) count+=1 print(count)
p03325
n=int(eval(input())) a=list(map(int,input().split())) #print(n) #print(a) count=0 flag=True while(flag): flag=False for i in range(n): if(a[i]%2==0): #print(i) #a=list(map(lambda x:x*3,a)) a[i]=int(a[i]/2) #print(a) count+=1 ...
n=int(eval(input())) a=list(map(int,input().split())) #print(n) #print(a) count=0 flag=True while(flag): flag=False for i in range(n): while(a[i]%2==0): #print(i) #a=list(map(lambda x:x*3,a)) a[i]=int(a[i]/2) #print(a) count+=1 ...
p03325
n = int(eval(input())) a = [int(i) for i in input().split()] b = 1 for i in a: b *= i c = 0 while b % 2 == 0: b //= 2 c += 1 print(c)
n = int(eval(input())) a = [int(i) for i in input().split()] b = 1 c = 0 for i in a: b = i while b % 2 == 0: b //= 2 c += 1 print(c)
p03325
n=int(eval(input())) a=list(map(int,input().split())) c=0 b=a[0] for i in range(1,n): b=b*a[i] for i in range(100000): if b%2==0: b=b//2 c+=1 print(c)
n=int(eval(input())) a=list(map(int,input().split())) c=0 for i in range(0,n): while a[i]%2==0: a[i]=a[i]//2 c+=1 print(c)
p03325
N = int(eval(input())) A = [int(i) for i in input().split()] count = 0 flag = 1 while flag != 0: flag = 0 for i, a in enumerate(A): if a % 2 == 0: A[i] = a/2 count += 1 flag = 1 break print(count)
N = int(eval(input())) A = [int(i) for i in input().split()] count = 0 flag = 1 while flag != 0: flag = 0 for i, a in enumerate(A): if a % 2 == 0: A[i] = a/2 count += 1 flag = 1 print(count)
p03325
n = int(eval(input())) a = [int(c) for c in input().split()] count = 0 for n in a: x = n while x % 2 == 0: x /= 2 count += 1 print(count)
def main(): N = int(eval(input())) ans = 0 for a in [x for x in map(int, input().split()) if x % 2 == 0]: i = a while i % 2 == 0: i //= 2 ans += 1 print(ans) main()
p03325
N = int(eval(input())) a = tuple(map(int, input().split())) ans = 0 for aa in a: while aa % 2 == 0: aa //= 2 ans += 1 print(ans)
def main(): def count(x): ret = 0 while x % 2 == 0: x //= 2 ret += 1 return ret N = int(eval(input())) a = list(map(int, input().split())) ans = sum(map(count, a)) print(ans) if __name__ == '__main__': main() # import sys # in...
p03325
# -*- coding: utf-8 -*- n = int(eval(input())) a = list(map(int,input().split())) af = [[]] def factorize(n): b = 2 fct = [] while b * b <= n: while n % b == 0: n //= b fct.append(b) b = b + 1 if n > 1: fct.append(n) return fct for...
n = int(eval(input())) a = list(map(int,input().split())) cnt = 0 for i in range(n): while(True): if a[i] % 2 != 0: break else: a[i] = int(a[i] / 2) cnt += 1 print(cnt)
p03325
n=int(eval(input())) a=list(map(int,input().split())) even=[x for x in a if x%2==0] ans=0 while even!=[]: delval=0 even[0]//=2 len_even=len(even) for i in range(len_even): if i==0: if even[i]%2!=0: del even[i] delval+=1 else: ...
n=int(eval(input())) a=list(map(int,input().split())) ans=0 for i in a: buf=i ans+=format(buf,'b')[::-1].find('1') print(ans)
p03325
n = int(eval(input())) a = list(map(int, input().split())) cnt = 0 flg = True while flg: flg = False for i in range(0, n): if not a[i]%2: a[i] = a[i] / 2 flg = True cnt += 1 break print(cnt)
n = int(eval(input())) a = list(map(int, input().split())) cnt = 0 flg = True while flg: flg = False minus = 0 for i in range(0, len(a)): if not a[i+minus]%2: a[i+minus] = a[i+minus] / 2 flg = True cnt += 1 break else: a.pop(i+minus) minus -= 1 print...
p03325
n=int(eval(input())) a=list(map(int,input().split())) ans=0 for i in a: while i%2==0: i/=2 ans+=1 print(ans)
n=int(eval(input())) a=list(map(int,input().split())) ans=0 for i in a: cnt=0 while i%2==0: i//=2 cnt+=1 ans+=cnt print(ans)
p03325
def I(): return int(eval(input())) def LI(): return list(map(int,input().split())) ################################################## N = I() a = [x for x in LI() if x%2==0] ans = 0 while 1: if len(a)==0: print(ans) break ans += len(a) for i,x in enumerate(a): a[i] /= 2 ...
def I(): return int(eval(input())) def LI(): return list(map(int,input().split())) ################################################## N = I() a = [x for x in LI() if x%2==0] ans = 0 while 1: if len(a)==0: print(ans) break ans += len(a) a = [x/2 for x in a if x/2%2==0]
p03325
n = int(eval(input())) a = list(map(int, input().split())) ans = 0 for i in range(n): if a[i]%2==0: while a[i]%2==0: a[i] //= 2 ans += 1 print(ans)
n=int(eval(input())) a=list(map(int,input().split())) ans=0 for i in a: while i%2==0: i=i//2 ans+=1 print(ans)
p03325
n = int(eval(input())) a = list(map(int,input().split())) g = 0 for i in a: while i%2==0: g+=1 i/=2 print(g)
n = int(eval(input())) a = list(map(int,input().split())) ans = 0 for i in range(n): while a[i]%2==0: a[i] = a[i]//2 ans+=1 print(ans)
p03325
import sys stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline() n = ni() a = na() ans = 0 while True: dtwo = 0 for i in range(n): if a[i] % 2 == 0 and dtwo == 0: a[i]//=2 dtwo = 1 ...
import sys stdin = sys.stdin ni = lambda: int(ns()) na = lambda: list(map(int, stdin.readline().split())) ns = lambda: stdin.readline() n = ni() a = na() # ans = 0 # while True: # dtwo = 0 # for i in range(n): # if a[i] % 2 == 0 and dtwo == 0: # a[i]//=2 # dtwo...
p03325
from functools import reduce def count_two(n): two_count = 0 while n != 0 and n % 2 == 0: two_count += 1 n //= 2 return two_count n = int(eval(input())) a = list(map(int, input().split())) a_product = reduce(lambda x, y: x*y, a) print((count_two(a_product)))
from functools import reduce def count_two(n): two_count = 0 while n != 0 and n % 2 == 0: two_count += 1 n //= 2 return two_count n = int(eval(input())) a = list(map(int, input().split())) a_two_count_sum = sum([count_two(ai) for ai in a]) print(a_two_count_sum)
p03325
from functools import reduce def count_two(n): two_count = 0 while n != 0 and n % 2 == 0: two_count += 1 n //= 2 return two_count n = int(eval(input())) a = list(map(int, input().split())) a_two_count_sum = sum([count_two(ai) for ai in a]) print(a_two_count_sum)
def count_two(n): two = 0 while n%2 == 0: n //= 2 two += 1 return two n = int(eval(input())) a = [int(m) for m in input().split(" ")] print((sum([count_two(a_n) for a_n in a])))
p03325
import sys def solve(): input = sys.stdin.readline N = int(eval(input())) A = [int(a) for a in input().split()] count = 0 for i in range(N): while A[i] % 2 == 0: count += 1 A[i] //= 2 print(count) return 0 if __name__ == "__main__": solv...
import sys def solve(): input = sys.stdin.readline N = int(eval(input())) A = [int(a) for a in input().split()] count = 0 for i in range(N): while A[i] % 2 == 0: A[i] //= 2 count += 1 print(count) return 0 if __name__ == "__main__": solv...
p03325
N = int(eval(input())) A = list(map(int, input().split())) def factorization(n): arr = {} temp = n for i in range(2, int(-(-n ** 0.5 // 1)) + 1): if temp % i == 0: cnt = 0 while temp % i == 0: cnt += 1 temp //= i arr[i]...
N = int(eval(input())) A = list(map(int, input().split())) def factorization(n): arr = {} temp = n i = 2 if temp % i == 0: cnt = 0 while temp % i == 0: cnt += 1 temp //= i arr[i] = cnt return arr ans = 0 for a in A: arr = facto...
p03325
n=int(eval(input())) a=sorted([int(i) for i in input().split()]) cnt=0 while True: odd=[i for i in a if i%2==1] even=[i for i in a if i%2==0] if len(even)==0: break maxi=even[-1] even=[i*3 for i in even[0:-1]] even.append(maxi//2) a=odd+even cnt+=1 print(cnt)
n=int(eval(input())) a=[int(i) for i in input().split()] cnt=0 for i in range(n): while a[i]%2==0: a[i]=a[i]//2 cnt+=1 print(cnt)
p03325
N = int(eval(input())) A = list(map(int,input().split())) ans = 0 for a in A: while a > 0 and a%2 == 0: a //= 2 ans += 1 print(ans)
N = int(eval(input())) a = list(map(int,input().split())) ans = 0 for e in a: while e%2 == 0: ans += 1 e //= 2 print(ans)
p03325
N=int(eval(input())) A=list(map(int,input().split())) ans=0 for i in range(N): while A[i]%2==0: ans+=1 A[i]//=2 print(ans)
N=int(eval(input())) A=list(map(int,input().split())) ans=0 for i in range(N): while A[i]%2==0: A[i]//=2 ans+=1 print(ans)
p03325
import sys input = sys.stdin.readline def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: ...
import sys input = sys.stdin.readline def main(): n = int(eval(input())) a = list(map(int,input().split())) ans = 0 for i in a: count = 0 while i // 2 * 2 == i: i = i // 2 count += 1 ans += count print(ans) if __name__ == '__main__...
p03325
def num_divisions(num): for i in range(1+num): if num % 2**i == 0: pass else: return i - 1 N = int(eval(input())) A = list(map(int, input().split())) cnt = 0 for a in A: cnt += num_divisions(a) print(cnt)
def decompose_by_2(n): cnt = 0 while True: if n % 2 == 1: return cnt n = n / 2 cnt += 1 _ = eval(input()) A = list(map(int, input().split())) cnt = 0 for a in A: cnt += decompose_by_2(a) print(cnt)
p03325
n=int(eval(input())) a=list(map(int,input().split())) cnt = 0 while all([i%2!=0 for i in a])!=True: for i in range(n): if a[i]%2==0: a[i]//=2 cnt+=1 break print(cnt)
n=int(eval(input())) a=list(map(int,input().split())) def cnt_div2(n): cnt=0 while n%2==0: n//=2 cnt+=1 return cnt #各要素に対して,2で割ることのできる回数をカウント lis = [cnt_div2(i) for i in a] print((sum(lis)))
p03325
N = int(eval(input())) A = list(map(int, input().split())) import math ans = 0 for i in range(N): a = A[i] b = int(math.log2(a))+1 for j in range(b): if a % 2 == 0: ans += 1 a = a/2 else: break print(ans)
N = int(eval(input())) ans = 0 A = list(map(int, input().split())) for i in range(N): a = A[i] while a%2 == 0: ans += 1 a = a//2 print(ans)
p03325
def main(): N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for a in A: while a%2 == 0: ans += 1 a /= 2 print(ans) if __name__ == "__main__": main()
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for a in A: tmp = a while tmp%2==0: ans += 1 tmp //=2 print(ans)
p03325
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for a in A: tmp = a while tmp%2==0: ans += 1 tmp //=2 print(ans)
N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for a in A: ans += bin(a)[::-1].index("1") print(ans)
p03325
N = int(eval(input())) a = list(map(int,input().split())) cnt = 0 while True: flg = False for i in range(N): if a[i] % 2 == 0: a[i] /= 2 break elif i == N - 1: print(cnt) flg = True if flg == True: break cnt += 1
N = int(eval(input())) a = list(map(int,input().split())) cnt = 0 for i in range(N): while True: if a[i] % 2 != 0: break else: cnt+=1 a[i] = a[i] / 2 print(cnt)
p03325
# AtCoder Beginner Contest 100 # C - *3 or /2 N=int(eval(input())) A=list(map(int,input().split())) count=0 A=[ a for a in A if a%2==0 ] while len(A)>0: _A=[] for a in A: if a==max(A): _a=a//2 if _a%2==0: _A.append(_a) else: ...
# AtCoder Beginner Contest 100 # C - *3 or /2 def f(N,c): if N%2==0: n=N//2 c+=1 return f(n,c) else: return c N=int(eval(input())) A=list(map(int,input().split())) count=0 for a in A: count+= f(a,0) print(count)
p03325
n = int(eval(input())) a = list(map(int, input().split())) count = 0 for i in a: while i % 2 == 0: i /= 2 count += 1 print(count)
n = int(eval(input())) a = [int(i) for i in input().split()] a = sorted(list([x for x in a if (x % 2) == 0]), reverse=True) ans = 0 for i in a: while i % 2 == 0: i //= 2 ans += 1 print((int(ans)))
p03325
# For taking integer inputs. import math def inp(): return(int(eval(input()))) # For taking List inputs. def inlist(): return(list(map(int, input().split()))) # For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because i...
# For taking integer inputs. import math def inp(): return(int(eval(input()))) # For taking List inputs. def inlist(): return(list(map(int, input().split()))) # For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because i...
p03325
n=int(eval(input())) l=list(map(int, input().split())) z=[] for i in range(n): x,y=0,l[i] for j in range(10**9): if y%2==0: x+=1 y=y//2 else: z.append(x) break print((sum(z)))
n=int(eval(input())) l=list(map(int, input().split())) z=[] for i in range(n): x,y=0,l[i] while y%2==0: x+=1 y=y//2 else: z.append(x) print((sum(z)))
p03325
# -*- coding:utf-8 -*- def solve(): N = int(eval(input())) A = list(map(int, input().split())) ans = 0 # 2**x の xの総和が答え for a in A: while a%2 == 0: a = a / 2 ans += 1 print(ans) if __name__ == "__main__": solve()
# -*- coding:utf-8 -*- def solve(): N = int(eval(input())) A = list(map(int, input().split())) ans = 0 # 素因数分解したときの2**x の xの総和が答え for a in A: while a%2 == 0: a = a / 2 ans += 1 print(ans) if __name__ == "__main__": solve()
p03325
#coding: utf-8 N = int(eval(input())) L = list(map(int, input().split())) cnt = 0 tri_cnt = 0 mem = 0 #全てが奇数になるまで実行し続ける while(tri_cnt != len(L)): if(L[mem]%2 != 0): mem += 1 else: L[mem] //= 2 # for i in range(len(L)): # if(i != mem): # #L[i]...
#coding: utf-8 N = int(eval(input())) L = list(map(int, input().split())) cnt = 0 tri_cnt = 0 mem = 0 #全てが奇数になるまで実行し続ける while(mem != len(L)): if(L[mem]%2 != 0): mem += 1 else: L[mem] //= 2 # for i in range(len(L)): # if(i != mem): # L[i] = L[...
p03325
n = int(eval(input())) a = list(map(int,input().split())) Sum = 0 for i in range(n): while a[i] % 2 == 0: a[i] /= 2 Sum += 1 print(Sum)
n = int(eval(input())) a = list(map(int,input().split())) cnt = 0 for i in range(n): if a[i] % 2 == 0: while a[i] % 2 == 0: a[i] = a[i] // 2 cnt += 1 print(cnt)
p03325
def prime_decomposition(n): i = 2 table = [] counter = 0 while i * i <= n: while n % i == 0: n /= i if i == 2: counter += 1 table.append(i) i += 1 if n > 1: if n == 2: counter += 1 table.append(n) return counter N = int(eval(input())) ...
def gu(x): counter = 0 while x % 2 == 0 and x != 0: x /= 2 counter += 1 return counter N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for i in range(N): if A[i] % 2 == 0: ans += gu(A[i]) print(ans)
p03325
import math #試し割法 def trial_division(n): #素因数を格納するリスト factor = [] #2から√n以下の数字で割っていく # c = 0 tmp = math.sqrt(n) + 1 tmp = int(tmp) for num in range(2,tmp): while n % num == 0: n //= num factor.append(num) #リストが空ならそれは素数 if not factor: ...
import math def wareru(s): buff = s c = 0 while True: if buff % 2 == 0: c+=1 buff = buff / 2 else: return c N = int(eval(input())) A = list(map(int, input().split())) ans = 0 for i in range(N): ans += wareru(A[i]) # if A[i] =...
p03325