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

建议使用的浏览器:

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

2347:Equations

题目描述
Given 2 equations on the variables x and y, solve for x and y.
输入解释
The first line of input contains N, the number of test cases. Each test case consists of two equations, each on a separate line. An empty line separates cases. An equation consists of two or more terms separated by addition, subtraction, or equality operators. A term is an integer, or a variable name (x or y) optionally preceded by a minus sign or an integer coefficient. There is exactly one equality operator. All operators are surrounded by spaces, and there are no spaces within terms.
输出解释
For each case, print two lines, giving the values of x and y as rationals in simplest terms. If x or y has no unique rational value such that both equations hold, print "don't know" for its value. Print an empty line between cases.
输入样例
7
2x + 3y = x
5 = x + y + 3

2x + 3y = 0
10x = -15y

2x + 3y = 0
10x = -15y + 1

x = 1
3x = 6y

2x = 3x + -x + y
x + y = x + y

2x = -3
-2y = 3

1 = 2
x = 3

输出样例
3
-1

don't know
don't know

don't know
don't know

1
1/2

don't know
0

-3/2
-3/2

don't know
don't know


该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-2347

最后修改于 2020-10-29T06:30:18+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536