#44402: 簡單理解


0801elmer666@gmail.com (薛冠志)

學校 : 國立霧峰高級農工職業學校
編號 : 273218
來源 : [210.60.228.152]
最後登入時間 :
2024-11-22 09:55:48
f579. 1. 購物車 -- 2020年7月APCS | From: [106.107.218.192] | 發表日期 : 2024-12-02 21:52

people_num = 0
a, b = map(int, input().split())
n = int(input())
for i in range(n):
total = []
total_min = []
somethings = list(map(int, input().split()))
some_long = len(somethings)
for h in range(some_long):
if somethings[h] == a:
total.append(somethings[h])
if somethings[h] == b:
total.append(somethings[h])
if somethings[h] == -a:
total_min.append(somethings[h])
if somethings[h] == -b:
total_min.append(somethings[h])
total_min_long = len(total_min)
for j in range(total_min_long):
s = 0
k = 0
while s != 1:
if total_min[j] == total[k] * -1:
total[k] = 0
s += 1
k += 1
end_long = len(total)
num = 0
for f in range(end_long):
if total[f] == a:
num += 1
for s in range(end_long):
if total[s] == a:
total[s] = 0
if total[f] == b:
num += 1
for s in range(end_long):
if total[s] == b:
total[s] = 0
if num == 2:
people_num += 1
print(people_num)
 
ZeroJudge Forum