Untitled

unknown
python
7 months ago
1.6 kB
2
Indexable
Never
```class Card:
def __init__(self,suit, rank):
self.suit=suit
self.rank=rank

Suit=input().split(',')
Rank=input().split(',')

card=[0]*5
for i in range(5):
card[i]=Card(Suit[i],Rank[i])

ans=0
# rule A
for i in range(5):
if card[i].rank=='A':
ans+=5

# rule B
for i in range(5):
for j in range(i+1, 5):
if card[i].rank == card[j].rank:
ans+=10

# rule C
same_suit = True
for i in range(1,5):
if card[i-1].suit!=card[i].suit:
same_suit=False
if same_suit:
ans+=30

# rule D
sorted_rank=[0]*5
for i in range(5):
if card[i].rank == 'A':
sorted_rank[i]= 1
elif card[i].rank == 'J':
sorted_rank[i]= 11
elif card[i].rank == 'Q':
sorted_rank[i]= 12
elif card[i].rank == 'K':
sorted_rank[i]= 13
else:
sorted_rank[i]=int(card[i].rank)

sorted_rank.sort()
not_consecutive = 0
for i in range(1,5):
if sorted_rank[i-1]+1 != sorted_rank[i]:
not_consecutive+=1
if not_consecutive==0 or (not_consecutive==1 and sorted_rank[0]==1 and sorted_rank[4]==13):
ans+=50

# rule E
if (sorted_rank[0]==sorted_rank[2] and sorted_rank[3]==sorted_rank[4]) or (sorted_rank[0]==sorted_rank[1] and sorted_rank[2]==sorted_rank[4]):
ans+=80

# rule F
if sorted_rank[0]==sorted_rank[4]:
ans+=100*4
elif sorted_rank[0]==sorted_rank[3] or sorted_rank[1]==sorted_rank[4]:
ans+=100

# rule G
if same_suit:
if not_consecutive==0 or (not_consecutive==1 and sorted_rank[0]==1 and sorted_rank[4]==13):
ans+=300

print(ans)

```