cf479A Expression
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.
1
2
3
9
2
10
3
60
div2的A啊……sb模拟
六种情况搞来搞去
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<ctime>
#define LL long long
#define inf 0x7ffffff
#define pa pair<int,int>
#define pi 3.1415926535897932384626433832795028841971
using namespace std;
LL a,b,c,ans;
inline LL read()
{
LL x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
int main()
{
a=read();b=read();c=read();
ans=a+b+c;
ans=max(ans,a+b*c);
ans=max(ans,a*b+c);
ans=max(ans,(a+b)*c);
ans=max(ans,a*(b+c));
ans=max(ans,a*b*c);
printf("%lld\n",ans);
}
cf479A
cf479A Expression的更多相关文章
- AutoMapper:Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type
异常处理汇总-后端系列 http://www.cnblogs.com/dunitian/p/4523006.html 应用场景:ViewModel==>Mode映射的时候出错 AutoMappe ...
- OpenCASCADE Expression Interpreter by Flex & Bison
OpenCASCADE Expression Interpreter by Flex & Bison eryar@163.com Abstract. OpenCASCADE provide d ...
- Expression Blend创建自定义按钮
在 Expression Blend 中,我们可以在美工板上绘制形状.路径和控件,然后修改其外观和行为,从而直观地设计应用程序.Button按钮也是Expression Blend最常用的控件之一,在 ...
- [C#] C# 知识回顾 - 表达式树 Expression Trees
C# 知识回顾 - 表达式树 Expression Trees 目录 简介 Lambda 表达式创建表达式树 API 创建表达式树 解析表达式树 表达式树的永久性 编译表达式树 执行表达式树 修改表达 ...
- Could not evaluate expression
VS15 调试变量不能显示值,提示:Could not evaluate expression 解决办法: 选择"在调试时显示运行以单击编辑器中的按钮"重启VS即可. 可参考:Vi ...
- 使用Expression实现数据的任意字段过滤(1)
在项目常常要和数据表格打交道. 现在BS的通常做法都是前端用一个js的Grid控件, 然后通过ajax的方式从后台加载数据, 然后将数据和Grid绑定. 数据往往不是一页可以显示完的, 所以要加分页: ...
- 使用Expression实现数据的任意字段过滤(2)
上一篇<使用Expression实现数据的任意字段过滤(1)>, 我们实现了通过CriteriaCollectionHandler对象来处理集合数据过滤.通过适当的扩展, 应该可以满足一般 ...
- React Native JSX value should be expression or a quoted JSX text.
问题描述: 我在使用props时候, 我的写法是这样的 ... <View> <Person name='john' age=32 gender=true></Pers ...
- [LeetCode] Ternary Expression Parser 三元表达式解析器
Given a string representing arbitrarily nested ternary expressions, calculate the result of the expr ...
随机推荐
- webapp设计注意事项
色彩设计 美学相关的知识(色彩构成.平面构成等等)我就不再赘述了,相信从事此类行业的人员无人不知无人不晓了.这里简要说说WebApp设计中,色彩以及构图的特别之处吧. 首先是色彩.从事过广告和印刷业设 ...
- Palindrome Subarrays
给定输入字符串,要求判断任意子字符串是否对称. 基本思路就是DP 写出DP表达式为 dp[i][j] = dp[i + 1][j - 1] && (s[i] == s[j]) dp[i ...
- 关于qt学习的一点小记录(2)
嗯...这次接了个单 要求图形界面,刚好可以巩固并学习下QT.毫不犹豫的就接了 下面记录下出现的问题: 1. QWidget和QDialog QDialog下的槽函数有accept()与reject( ...
- linux下面测试网络带宽 (转载)
利用bmon/nload/iftop/vnstat/iptraf实时查看网络带宽状况 一.添加yum源方便安装bmon# rpm -Uhv http://apt.sw.be/redhat/el5/en ...
- [android开发之内容更新类APP]二、这几日的结果
android教程即将開始 话说这开了blog之后,就一直在试用自己的app,发现.TM的真的非常不爽,不好用,好吧.本来打算放弃了.只是看到手机里还有还有一个坑,干脆又一次做一个吧. 原来的神回复A ...
- MFC读写配置文件
void CFileTextDoc::OnIniread() { // TODO: Add your command handler code here CString strStudName; ...
- E514:write error(file system full?)
vi编辑某文件,保存时报错,提示:E514: write error (file system full?)---写入错误,磁盘满了? 查看磁盘空间:df -h根目录磁盘空间已满,used%100. ...
- (转载)js获取JqueryString方法小结
一.<script>urlinfo=window.location.href; //获取当前页面的urllen=urlinfo.length;//获取url的长度offset=urlinf ...
- easyui-combobox绑定json数据
用的C#语言 后台取数据,就不用废话了,先看看序列化json数据 /// <summary> /// 对象转JSON /// </summary> /// <param ...
- Javascript进阶篇——浏览器对象—History对象
History 对象history对象记录了用户曾经浏览过的页面(URL),并可以实现浏览器前进与后退相似导航的功能.窗口被打开的那一刻开始记录,每个浏览器窗口.每个标签页乃至每个框架,都有自己的hi ...