博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【乱搞】【AOJ-34】Euchre Results
阅读量:5072 次
发布时间:2019-06-12

本文共 1644 字,大约阅读时间需要 5 分钟。

Description
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 51874 2945 2030 2789 1025 37940 0 0 0 0 0
 
Sample Output
Anna's won-loss record is 2-11.Anna's won-loss record is 4709-110.
大致翻译:四个女孩玩一种卡牌游戏,她们玩了很多场。两人一组,并且可以随时换组,比如这场AB一组 CD一组 ,AB赢了AB记一次win,BC输了BC记一次lose 下一局AC一组,BD一组 以此类推
现在Anna忘了她输赢多少局了,给出其他三个女孩的输赢次数 算出来Anna输赢多少局
 
思路:
解二元一次方程组即可
易知总的输赢场数相等,因为有赢必有输 设Anna win x lose y
则x+a+c+e=y+b+d+f
还有她们所有人玩的局数是相同的
则x+y=a+b=c+d=e+f
解出来即可
 
参考代码:
#include 
int main() { int a,b,c,d,e,f; while(scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f)&&(a||b||c||d||e||f)) printf("Anna's won-loss record is %d-%d.\n",(2*b+d+f-c-e)/2,(2*a+c+e-d-f)/2); return 0; }

 

转载于:https://www.cnblogs.com/ahu-shu/p/3511706.html

你可能感兴趣的文章
spring框架学习笔记(八)
查看>>
JS取得绝对路径
查看>>
排球积分程序(三)——模型类的设计
查看>>
python numpy sum函数用法
查看>>
Linux中的SELinux详解--16
查看>>
php变量什么情况下加大括号{}
查看>>
less入门
查看>>
如何实现手游app瘦身?
查看>>
linux程序设计---序
查看>>
【字符串入门专题1】hdu3613 【一个悲伤的exkmp】
查看>>
C# Linq获取两个List或数组的差集交集
查看>>
21.Longest Palindromic Substring(最长回文子串)
查看>>
HDU 4635 Strongly connected
查看>>
ASP.NET/C#获取文章中图片的地址
查看>>
Spring MVC 入门(二)
查看>>
Java处理多人同时读写文件的文件锁处理
查看>>
格式化输出数字和时间
查看>>
页面中公用的全选按钮,单选按钮组件的编写
查看>>
判断文本框输入的文字长度
查看>>
java笔记--用ThreadLocal管理线程,Callable<V>接口实现有返回值的线程
查看>>