若是凉夜已成梦

青春里 总有些事情要努力去做 总有些梦想要拼命去追。


  • 运维

  • 前端

  • 编程

  • 随笔

  • hust-oj

1140: Equations

发表于 2017-10-06   |   分类于 HUSTOJ   |   阅读次数 1,117

题目描述

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

参考代码

暂无

解析

暂无

hustoj

发表评论 取消回复

电子邮件地址不会被公开。 必填项已用*标注

*
*


hoxis wechat
著作权归作者所有
站点更新说明
  • 文章目录
  • 站点概览
若是凉夜已成梦

若是凉夜已成梦

青春里 总有些事情要努力去做 总有些梦想要拼命去追。

1904 日志
6 分类
12 标签
RSS
weibo github twitter facebook

友情链接

原站点 Skip Dreams孤独患者
© 2017 若是凉夜已成梦
Powered by WordPress | 已运行
Theme By NexT.Mist