PAT B brush Huaquan title Road 1046 (15 minutes)

Guessing Game 1046 (15 minutes)

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 format:
input of the first line to a given positive integer N (≦ 100), followed by N rows, each row Huaquan a given recording format:
A call to call B B A draw stroke
wherein the call is a call for digital, is planning to draw figures are positive integers no more than 100 (designated with two hands).
Output format:
in line successively output A, B two drinking cup number, with a space therebetween.

Sample input:
. 5
. 8. 9 12 is 10
. 5 10. 5 10
. 3. 5. 8 12 is
12 is 18 is 13 is. 1
. 4 16 15 12 is

Output Sample:
1 2

#include <iostream>
using namespace std;

int main()
{
	int N;
	cin>>N;
	int jhan[N],jhua[N],yhan[N],yhua[N],i,countj=0,county=0;
	for(i=0;i<N;i++){
		cin>>jhan[i]>>jhua[i]>>yhan[i]>>yhua[i];
	}
	for(i=0;i<N;i++){
		if(jhan[i]+yhan[i]==jhua[i]&&jhan[i]+yhan[i]==yhua[i]||jhan[i]+yhan[i]!=jhua[i]&&jhan[i]+yhan[i]!=yhua[i]){
		 	continue;
		}else if(jhan[i]+yhan[i]==yhua[i]&&jhan[i]+yhan[i]!=jhua[i]){
			countj++;
		}else{
			county++;
		}
	}
	cout<<countj<<" "<<county;
} 
Published 73 original articles · won praise 0 · Views 543

Guess you like

Origin blog.csdn.net/derbi123123/article/details/103790898