479A - Expression
来源:互联网 发布:怎样申请成为淘宝达人 编辑:程序博客网 时间:2024/05/16 09:46
Petya studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the last class the teacher wrote three positive integers a, b, c on the blackboard. The task was to insert signs of operations '+' and '*', and probably brackets between the numbers so that the value of the resulting expression is as large as possible. Let's consider an example: assume that the teacher wrote numbers 1, 2 and 3 on the blackboard. Here are some ways of placing signs and brackets:
- 1+2*3=7
- 1*(2+3)=5
- 1*2*3=6
- (1+2)*3=9
Note that you can insert operation signs only between a and b, and between b and c, that is, you cannot swap integers. For instance, in the given sample you cannot get expression (1+3)*2.
It's easy to see that the maximum value that you can obtain is 9.
Your task is: given a, b and c print the maximum value that you can get.
The input contains three integers a, b and c, each on a single line (1 ≤ a, b, c ≤ 10).
Print the maximum value of the expression that you can obtain.
123
9
2103
60
a, b, c= gets.to_i,gets.to_i,gets.to_iputs [a + b + c, (a + b) * c, a + b * c, a * b + c, a * (b + c), a * b * c].max
- codeforces-#479A. Expression
- 479A - Expression
- 479A - Expression
- codeforces 479A Expression
- Codeforces 479A Expression(水题)
- A. Expression
- A. Expression
- codeforces 479A(Expression) Java
- not a SELECTed expression
- evaluate a mathematical expression
- 【CODEFORCES】 A. Expression
- #274A. Expression
- Codeforces Round #274 A. Expression
- A. Expression(Codeforces Round #274)
- for循环中表达式执行顺序for(Expression a;Expression b;Expression c)
- A Simple Sample for Expression Tree
- A Simple Sample for Expression Tree
- ORA-01791:not a SELECTed expression
- ZOJ-3626(树形DP)
- 深度学习入门介绍系列2
- 架构师考试经验总结
- Linux线程-互斥锁pthread_mutex_t
- Swift-字典
- 479A - Expression
- WSN 路由协议
- XmlHttpRequest CORS 与 AJAX封装类
- C#(面向对象基础数组VS集合VS范型)下-2
- spring整合mybaits时Connections could not be acquired from the underlying database!异常解决
- Single Number II
- 让MAC系统为你唱中英文生日快乐歌
- c# ArrayList冒泡排序
- Android源码解析之Dialog