2012金华现场赛(北大出题)- J - Dressing


ls = list(map(int, input().split()))
while ls != [0, 0, 0]:
    clothes_nums, pants_nums, shoes_nums = ls
    n = int(input())
    clothes = {
     }
    pants = {
     }
    shoes = {
     }
    while n > 0:
        lst = list(input().split())
        i = int(lst[1])
        j = int(lst[3])
        if lst[0] == 'clothes':
            clothes[i] = 1
        elif lst[0] == 'pants':
            pants[i] = 1
        if lst[2] == 'pants':
            pants[j] = 1
        elif lst[2] == 'shoes':
            shoes[j] = 1
        n -= 1
    total = clothes_nums * pants_nums * shoes_nums - len(clothes) - len(pants) - len(shoes)
    print(total)
    ls = list(map(int, input().split()))

错的, 不想改了, 先这样

你可能感兴趣的:(2012金华现场赛(北大出题)- J - Dressing)