1046. Huaquan (15)

Source: Internet
Author: User

1046. Huaquan (15)

Huaquan is an interesting part of the ancient Chinese wine culture. Two people Huaquan on the table are: Each person's mouth shout out a number, at the same time by hand to figure out a number. If the figure is equal to the number of two people shouting the sum of the numbers, who wins, the loser penalty a glass of wine. Both win or lose with each other and continue the next round until the only winner appears.

Here are the Huaquan records for both A and B, please count how many glasses of wine they drank last.

Input format:

Enter the first line first to give a positive integer n (<=100), followed by n lines, each row gives a round of Huaquan records, in the form of:

A shout a row B shout B row

The "shout" is the number that is shouted out, and the number of "strokes" is a positive integer of not more than 100 (two hand strokes).

Output format:

In one row successively output A, B two people drink the number of cups, in the meantime separated by a space.

Input Sample:
58 10 9 125 10 5 103 8 5 1212 18 1 134 16 12 15
Sample output:
1 2
1#include <stdio.h>2 intMain ()3 {4   inttest,countj=0, county=0;5scanf"%d",&test);6    while(test--)7   {8     inta,b,c,d;9scanf"%d%d%d%d",&a,&b,&c,&d);Ten     if(b==a+c&&d==a+c| | b!=a+c&&d!=a+c) One       Continue;//without a winner, jump straight to the next inning . A     Else if(b==a+c&&d!=a+c) -county++;//A win, B drinks . -     Else if(b!=a+c&&d==a+c) thecountj++;//b win a drink -   } -printf"%d%d\n", countj,county); -   return 0; +}

1046. Huaquan (15)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.