atcoder abc_121 を解いてみた(python3)
-A. [AC]White Cells
# -*- coding: utf-8 -*- H, W = map(int, input().split()) h, w = map(int, input().split()) print(H*W-h*W-w*(H-h))
-B. [AC]Can you solve this?
# -*- coding: utf-8 -*- n, m, c = map(int, input().split()) lst = [] for i in range(n+1): lst_1 = list(map(int, input().split())) lst.append(lst_1) a=0 b=0 for j in range(n): for i in range(m): a = a + lst[0][i]*lst[j+1][i] if a+c>0: b=b+1 a=0 print(b)
for文内でAとBのソースコードをリストとして読み取り、さらにリストに追加していく。
次のfor文内でBのソースコード(lst[0])の要素に、Aのソースコード(lst[1~n+1])の要素をそれぞれ掛けあわせる。
-C. Energy Drink Collector
-D. XOR World
今回のコンテスト後のレート