PAT B exam "fool" the solution of the problem Guessing Game

Guessing Game is an interesting part of the ancient Chinese wine culture. Finger Guessing Game two of wine on the table method is: the mouth of a digital person shouted, while a hand than to draw a number. If the ratio figures who draw is exactly equal to the sum of the two numbers shouted, whoever wins, the loser penalty of one glass of wine. Both of them win or lose with the two proceed to the next round until only the winner appears.

Here are A, B two Guessing Game record, you count them separately how much to drink last glass of wine.

Input formats:

First input of the first row is given a positive integer N ( . 1 0 0), followed by N rows, each row Huaquan a given recording format:

甲喊 甲划 乙喊 乙划

Wherein is shouted figures are drawn numbers are positive integers not more than 100 (designated with two hands).

Output formats:

A successively output in a row, the number of cups of drink B two, with a space therebetween.

Sample input:

5
8 10 9 12
5 10 5 10
3 8 5 12
12 18 1 13
4 16 12 15

Sample output:

1 2
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int numbera=0,numberb=0;
    for(int i=0;i<n;i++)
    {
        int x,x1,y,y1;
        cin>>x>>x1>>y>>y1;
        if(x+y==x1)
            if(x+y!=y1) numberb++;
            else continue;
        else
            if(x+y==y1) numbera++;
            else continue;
    }
    cout<<numbera<<" "<<numberb;
    return 0;
}

 

Guess you like

Origin www.cnblogs.com/solititude/p/11846327.html