计算比分等式中的变量,怎么采用C语言的程序的设计的代码的编写的思想的方法来实现的呢?

Problem Description
You: What's the score? Did I miss much?

Me: It's 2-1 for elAhli and the second half just started. The first half was quite boring.

You: Who scored first? elAhli or ezZamalek?

Me: What difference does it make?

You: Big difference! I can predict the outcome of the match if I knew the order of which goals were scored in the first half.

Me: What do you mean?

You: It's 2-1 for elAhli, right? One of three things could have happened: elAhli scored two goals then ezZamalek scored; Or, elAhli scored its first goal, then ezZamalek, then elAhli again; Or, ezZamalek scored first, then elAhli scored its two goals.

Me: So?!! I still don't understand what difference does that make? It's still 2-1 for elAhli! Why don't you just relax and let us continue watching the game in peace.

You: You don't understand!! I believe the probability of who'll win depends on the order of how goals were scored. Now I have to predict the outcome for 3 possibilities.

Me: And what if the score was 3-2? What would you have done then?

You: I would have to work for 5 different possibilities. No?

Me: Of course not! The number of possibilities isn't always equal to the sum.

You: Can you tell me when will it be equal to the sum?

Me: You're a programmer, why don't you write a program that counts the number of possibilities and compare it to the sum?

You: I don't have the time, I want to watch the match. Besides, I have nine other problems to worry about.

Me: I'll give you a hint. The possibilities will be equal to the sum only if one of the teams scored a certain number of goals.

Input
Your program will be tested on one or more test cases. Each test case specifies two natural numbers (A and B ) (separated by one or more spaces) representing the score of the first half. No team will be able to score more than 10 goals. The last line of the input file contains two -1's (which is not part of the test cases.)

Output
Format For each test case where the number of possibilities is equal to the sum, print:

A +B =C

Where A and B are as above and C is their sum. If the number of possibilities is not equal to the sum, replace the =' sign with!=' (without the quotes.)

Sample Input
2 1
1 0
-1 -1

Sample Output
2+1=3
1+0=1

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问

相似问题

1
新手提问,fmincon函数问题,求大佬解答
1
一个有关方程等式的问题,用C语言求大神快点来帮助
2
用C语言计算axs(n)=bxs(2n)满足这个等式的值,怎么计算的?
1
表达式计算,求出相等的表达式构成的等式,采用C语言实现计算
2
使用quadprog++函数库的问题
1
python多重背包问题,已有最佳值,如何获得该最佳的具体方案
0
用等式构造出来的一个字符串比较的问题,怎么利用C语言形式算法解决
0
函数方程等式的递归的一个比较的算法,如何利用C语言的思路去实现的
0
等式的行的系数的问题,利用C程序语言编程的办法来实现
1
用给的数字去判断一共可以得到多少个等式,利用C程序编写的方式来实现怎么做的
0
分数和分数的平方的等式问题利用C语言的办法如何求解,具体一个问题的代码的实现
0
数学上比较复杂的等式类问题的计算在C语言的程序设计的过程中的实现的思路?
0
从给定的数字里寻找可以得到的等式,怎么运用C语言程序编写的代码的实现的方式去计算?
0
用字符串来表示的等式的问题的算法,采用C语言程序设计语言编写程序代码的思路做法
2
老哥们,matlab中怎么将图二已知的等式带入图一中的矩阵,将图一中的w的幂进行化简。
1
计算,以下式子是否成立,怎么用C语言编程写得代码来计算这个等式的成立呢?
0
从给定的数字里提取等式,输出能找到多少等式,用C语言的编程思想的代码编写实现的思路方法
0
给出一组指定的数字,现在问可以找出多少等式,怎么使用C语言的程序编写过程去实现呢
0
三个变量系数构成一个等式通过计算求出,怎么使用C语言的程序编写代码的方式去实现
1
再一个乘法等式中出现所有的数字,怎么用C语言的程序编写代码设计的技术的方式来实现的呢