目的
本記事は、自身のAtCoderで実装能力を可視化するために備忘録として残していくためのものなのであしからず。初心者なので実装が拙いのはご容赦ください。
模範解答
Product
# -*- coding: utf-8 -*-
a,b = map(int,input().split())
if (a*b)%2 ==0:
print("Even")
elif (a*b)%2 == 1:
print("Odd")
Placing Marbles
s = input()
print(sum([int(i) for i in s]))
Shift only
N = int(input())
a = list(map(int,input().split()))
def counter(i):
c_ = 0
while i%2 == 0:
i = i//2
c_ = c_ +1
return c_
c = [counter(a[i]) for i in range(N)]
count = min(c)
print(count)
Coins
A = int(input())
B = int(input())
C = int(input())
X = int(input())
counter = 0
for ia in range(A+1):
for ib in range(B+1):
for ic in range(C+1):
x = 500*ia + 100*ib + 50*ic
if X == x:
counter = counter + 1
print(counter)
Some Sums
N,A,B = map(int,input().split())
number = []
for i in range(N):
n = i+1
n_ = sum([int(i) for i in str(n)])
if n_ >= A and B>=n_:
number.append(n)
print(sum(number))
Card Game for Two
N = int(input())
a = list(map(int,input().split()))
alice_selct = []
bob_selct = []
def Alice_selector(a,alice_selct):
i = max(a)
a.remove(i)
alice_selct.append(i)
return a,alice_selct
def Bob_selector(a,bob_selct):
i = max(a)
a.remove(i)
bob_selct.append(i)
return a,bob_selct
for i in range(N):
if len(a) != 0:
a,alice_selct = Alice_selector(a,alice_selct)
else:
break
if len(a) != 0:
a,bob_selct = Bob_selector(a,bob_selct)
else:
break
print(sum(alice_selct)-sum(bob_selct))
Kagami Mochi
N = int(input())
d = []
for i in range(N):
d.append(int(input()))
print(len(set(d)))
Otoshidama
N,Y = map(int,input().split())
status = 0
for ix in range(N+1):
for iy in range(N+1-ix):
iz= N - ix - iy
y = 10000*ix + 5000*iy + 1000*iz
if y == Y:
status = 1
if status == 1:
break
if status == 1:
break
if status == 0:
print("-1 -1 -1")
else:
print(ix,iy,iz)
白昼夢
S = input()
S=S.replace("eraser","")
S=S.replace("erase","")
S=S.replace("dreamer","")
S=S.replace("dream","")
if len(S) == 0:
print("YES")
else:
print("NO")