🐥

2023/01/09に公開

# A01 - The First Problem

``````n = int(input())

s = n * n
print(s)
``````

# A02 - The First Problem

``````n, m = map(int, input().split())

S = list(map(int, input().split()))

Q = 0

for i in range(n):
if S[i] == m:
print("Yes")
Q += 1
break

if Q != 1:
print("No")
``````

# A03 - Two Cards

``````n, k = map(int, input().split())

p = list(map(int, input().split()))
q = list(map(int, input().split()))

papa = 0
for i in range(n):
for g in range(n):
if p[i] + q[g] == k:
print("Yes")
papa += 1
break
else: continue
break

if papa != 1:
print("No")
``````

break -> else: continue を置く

# A04 - Binary Representation 1

``````N = int(input())

list = []
for i in range(10):
r = int((N/(2 ** i)) % 2)
list.append(r)

list.reverse()
``````

ちなみに10進法の数kを2進法に変換する方法（2進法でn桁）

``````list = []
for i in range(n)
list.append((k/2 ** i) % 2) #一桁目から順々に格納する
list.reverse() #順番が逆になっているのでreverse()で逆向きにする
``````

# A05 - Three Cards

これはpypyじゃないと通らなかった

``````n, k = map(int, input().split())
count = 0
list = []　#リストはデバッグ用
for i in range(n):
red = i + 1
for g in range(n):
blue = g + 1
white = k - red - blue
if white > 0 and n >= white:
list.append([red,blue,white])　#リストはデバッグ用
count += 1
print(count)
``````

# B01 - A+B Problem

``````A, B = map(int, input().split())
print(A+B)
``````

# B02 - Divisor Check

``````A, B = map(int, input().split())
count = 0
for i in range(B-A+1):
number = i + A #numberでA以上B以下の数を全て試行する
if 100 % number == 0:
count += 1
break

if count > 0:
print("Yes")
else: print ("No")
``````

# B03 - Supermarket 1

``````n = int(input())
A = list(map(int, input().split()))
count = 0
for i in range(n):
for j in range(n):
for k in range(n):
if i == j or j == k or i == k:
continue
elif A[i] + A[j] + A[k] == 1000:
count += 1
break

if count > 0:
print("Yes")
else: print("No")
``````

# B04 - Binary Representation 2

``````n = int(input(),2)
print(n)
``````

ちゃんとやるならこう

``````n = input()
str_n = list(n)