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

建议使用的浏览器:

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

1348:Computing

题目描述
Input any five positive integral numbers n1, n2, n3, n4, n5, such that 0<=ni<=100, 1<=i<=5. To the first four positive integral numbers (n1, n2, n3, n4) the arithmetic operation, such as addition (+), subtraction (-), multiplication (*), or division (/) and brackets ('(',')') may be freely applied, but in the arithmetic expression formed with these numbers and operations, every one of the four integral numbers should be used once and only once.
Write a program for finding an arithmetic expression that satisfies the above requirement and equals n5.
输入解释
The input file consists of a number of data sets.Each data set is a line of 5 numbers separated by blank.A line of a single -1 represents the end of input.
输出解释
For each data set output the original data set first.If the program finds out the expression for these four arbitrary input numbers, then it gives out the output "OK!";On the contrary, if the program could not get the result of n5 by any arithmetic operations to the four input numbers, it gives output "NO!".
输入样例
1 2 3 4 50
2 3 10 1 61
-1
输出样例
1 2 3 4 50 NO!
2 3 10 1 61 OK!

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

题目来源 Xi'an 2002

源链接: POJ-1348

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

共提交 0

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