A問題 Blood Pressure
1 2 3 |
a,b = map(int, input().split()) c = (a-b)/3+b print(c) |
B問題 Cycle Hit
1 2 3 4 5 6 7 8 |
list = [] for i in range(4): list.append(input()) #[1] if 'H' in list and '2B' in list and '3B' in list and 'HR' in list: print('Yes') #[2] else: print('No') |
[1]
4回の入力があるため、4回のループ処理の中で、input()により入力された値をそのままリストに追加しています。
[2]
指定の4種類の文字列が全て含まれていれば良いので、if文による条件式は指定の文字列がリストの中に存在するかをandで繋ぎながら設定し、条件に合えば Yesと表示させます。
コメント