Happy Chinese Poker is a Chinese Poker game involved by three players. In each round, there is one player running for the landlord, while the other two players are farmers. The game always ends with the victory of the landlord or farmers, and the game uses happy beans for trading. The transaction of happy beans appears in the following cases:
- If a farmer wins in each round of game, then another farmer also wins. As a result, the landlord has to pay 1000 happy beans for his failure, and each farmer can get 500 happy beans.
- If the landlord wins in each round of game, both two farmers have to pay 500 happy beans respectively for their failure and the landlords win 1000 happy beans.
- Each player has to pay 100 happy beans for each round as a game fee.
The boy A is addicted to the game, Happy Chinese Poker, because he enjoys the pleasure of winning happy beans. Today he invited his friends B and C to play the game for N rounds. Assuming that all of them have enough happy beans and their wins or loses situation in each round is known, can you help A count today’s profit and loss situation of happy beans ( the difference value between the time A starts the game and finishes the game )
There are multiply cases.(<=200) Each case’s first line contains an integer N represent play the game for N rounds .(N<=1000) In next N lines,every line contains three integers a,b,c(Respectively, said A, B, C game win or lose , 0 represent lose , 1represent win)
For each case , output an integer represent today’s profit and loss situation of happy beans for A in one line.
3 0 1 1 0 0 1 1 1 0 1 1 0 0
-1300
900
A,B,C三个人斗地主,逐局确定A是农民还是地主以及胜负情况,最后算出A的得分。
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int T,a,b,c,ans;
while(~scanf("%d",&T))
{
ans=-100*T;
while(T--)
{
scanf("%d%d%d",&a,&b,&c);
if(a+b+c==2)
{
if(a)
ans+=500;
else
ans-=1000;
}
else
{
if(a)
ans+=1000;
else
ans-=500;
}
}
printf("%d\n",ans);
}
return 0;
}