当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3270:The Diophantine Equation

题目描述
We will consider a linear Diaphonic equation here and you are to find out whether the equation is solvable in non-negative integers or not.
Easy, is not it?
输入解释
There will be multiple cases. Each case will consist of a single line expressing the Diophantine equation we want to solve. The equation will be in the form ax + by = c. Here a and b are two positive integers expressing the co-efficient of two variables x and y.
There are spaces between:
1. “ax” and ‘+’
2. ‘+’ and “by”
3. “by” and ‘=’
4. ‘=’ and “c”

c is another integer that express the result of ax + by. -1000000<c<1000000. All other integers are positive and less than 100000. Note that, if a=1 then ‘ax’ will be represented as ‘x’ and same for by.
输出解释
You should output a single line containing either the word “Yes.” or “No.” for each input cases resulting either the equation is solvable in non-negative integers or not. An equation is solvable in non-negative integers if for non-negative integer value of x and y the equation is true. There should be a blank line after each test cases. Please have a look at the sample input-output for further clarification.
输入样例
2x + 3y = 10
15x + 35y = 67
x + y = 0
输出样例
Yes.

No.

Yes.

HINT: The first equation is true for x = 2, y = 2. So, we get, 2*2 + 3*2=10.
Therefore, the output should be “Yes.”
来自杭电HDUOJ的附加信息
Author Muhammed Hedayet
Recommend chenheng

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3270

最后修改于 2020-10-25T23:01:50+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000/500MS(Java/Others) 32768/32768K(Java/Others)