---
# System prepended metadata

title: k848. P2.卡牌評分 (Card)

---

# k848. P2.卡牌評分 (Card)
## 題目連結:[k848](https://zerojudge.tw/ShowProblem?problemid=k848)

## 解題想法
* 雖然每張卡有三個屬性，但把每個屬性獨立成一個陣列方便操作
* 因為不一定只有一個最大，所以要用`for`迴圈來找最大


## 程式碼
```py=
num = int(input()) #num張卡牌
atk = [0 for i in range(num)]
defend = [0 for i in range(num)]
hearts = [0 for i in range(num)]
points = [0 for i in range(num)] #卡牌的分數
for i in range(num):
    atk[i],defend[i],hearts[i] = map(int,input().split())

#找每個屬性的最大
best_atk = max(atk)
best_defend = max(defend)
best_hearts = max(hearts)

#算分數
for i in range(num):
    if atk[i] == best_atk:
        points[i] += 1
    if defend[i] == best_defend:
        points[i] += 1
    if hearts[i] == best_hearts:
        points[i] += 1

print(points.index(max(points))+1)
```