Euchre Results(水)

Time Limit: 2 Seconds Memory Limit: 65536 KB

Anna, Betty, Cindy and Zelda like playing the card game Euchre. Euchre is a game for two teams of two, and each time they meet the girls split off into different teams. They also keep overall records of the number of games each player has won and lost. Anna has misplaced her won-loss results, but she does have the results of the other three players. Given this, she figures she can determine her won-loss record.

Input

Input will consist of multiple problem instances. Each instance will consist of a single line containing six integers. The first two are the number of wins and losses (respectively) for Betty, the next two are the number of wins and losses for Cindy and the last two are the number of wins and losses for Zelda. A final line of six zeroes will terminate input and should not be processed.

Output

For each problem instance, output a single line indicating Anna's won-loss record, in the format shown in the example below.

Sample Input

10 3 6 7 8 5
1874 2945 2030 2789 1025 3794
0 0 0 0 0 0

Sample Output

Anna's won-loss record is 2-11.
Anna's won-loss record is 4709-110.

Source: East Central North America 2003, Practice

#include <stdio.h>
#include <math.h>

int main(){
int a[6];
int x,y,sum;
int i;
while(scanf("%d%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5]) != EOF){
    if(a[0]==0&&a[1]==0&&a[2]==0&&a[3]==0&&a[4]==0&&a[5]==0) break;
    sum = a[0]+a[1];
    for(i=0;i<=sum;i++){
        x = i;
        y = sum-i;
        if((a[0]+a[2]+a[4]+x) == (a[1]+a[3]+a[5]+y)){
            printf("Anna's won-loss record is %d-%d.\n",x,y);
        }
    }
}
return 0;
} 

while(scanf("%d%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5]) != EOF){可以改为while(true){scanf("%d%d%d%d%d%d",&a[0],&a[1],&a[2],&a[3],&a[4],&a[5])}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,461评论 0 10
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 9,984评论 0 23
  • 谢谢大大如此坦诚而细致的回答!原来大大经历过那么大的事,我想如果是我肯定挺不过去。好在现在的大大生活甜蜜而充...
    亲爱的艾糖阅读 358评论 0 1
  • 《等》 夜空变纯白 时钟逆摇摆 静谧形容大海 森林漂为无彩 彼得潘不是小孩 而你在等我回来 在云吞云吐间等我回来 ...
    一只大越越越阅读 598评论 10 6
  • 我今天演讲的题目是——童话剧让学生悄然变化着 我们毛虫教室排练的童话剧是《花格子大象艾玛》。因为是第一次演童话剧,...
    叶落心飞1318阅读 498评论 0 0