H - Happy Chinese Poker

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:

  1. 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.
  2. 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.
  3. 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 )

Input

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)

Output

For each case , output an integer represent today’s profit and loss situation of happy beans for A in one line.

Sample Input
3
0 1 1
0 0 1
1 1 0

1
1 0 0
Sample Output
-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;
}
    
    




























  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值