A. Expression

time limit per test1 second

memory limit per test256 megabytes

inputstandard input

outputstandard output

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.

Input

The input contains three integers a, b and c, each on a single line (1 ≤ a, b, c ≤ 10).

Output

Print the maximum value of the expression that you can obtain.

Sample test(s)

input

1

2

3

output

9

input

2

10

3

output

60

枚举飘过

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <list>
#include <algorithm>
#define LL long long
#define RR freopen("output.txt","r",stdoin)
#define WW freopen("input.txt","w",stdout) using namespace std; const int MAX = 100100; int main()
{
int a,b,c;
int Max;
while(~scanf("%d %d %d",&a,&b,&c))
{
Max=0;
Max=max(Max,a+b+c);
Max=max(Max,a*(b+c));
Max=max(Max,(a+b)*c);
Max=max(Max,a*b*c);
Max=max(Max,a*b+c);
Max=max(Max,a+b*c);
printf("%d\n",Max);
}
return 0;
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

周赛-Expression 分类: 比赛 2015-08-02 09:35 3人阅读 评论(0) 收藏的更多相关文章

  1. Hdu 1507 Uncle Tom's Inherited Land* 分类: Brush Mode 2014-07-30 09:28 112人阅读 评论(0) 收藏

    Uncle Tom's Inherited Land* Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (J ...

  2. iOS开源库--最全的整理 分类: ios相关 2015-04-08 09:20 486人阅读 评论(0) 收藏

    youtube下载神器:https://github.com/rg3/youtube-dl 我擦咧 vim插件:https://github.com/Valloric/YouCompleteMe vi ...

  3. Jquery easy UI 上中下三栏布局 分类: ASP.NET 2015-02-06 09:19 368人阅读 评论(0) 收藏

    效果图: 源代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://w ...

  4. C# IIS应用程序池辅助类 分类: C# Helper 2014-07-19 09:50 249人阅读 评论(0) 收藏

    using System.Collections.Generic; using System.DirectoryServices; using System.Linq; using Microsoft ...

  5. PIGS 分类: POJ 图论 2015-08-10 09:15 3人阅读 评论(0) 收藏

    PIGS Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 18209 Accepted: 8277 Description Mir ...

  6. Babelfish 分类: 哈希 2015-08-04 09:25 2人阅读 评论(0) 收藏

    Babelfish Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 36398 Accepted: 15554 Descripti ...

  7. java 解决JFrame不能设置背景色的问题 分类: Java Game 2014-08-15 09:48 119人阅读 评论(0) 收藏

    这段时间比较多,于是写一写JAVA的一些IT技术文章.如有JAVA高手请加QQ:314783246,互相讨论. 在Java的GUI设计中,Frame和JFrame两者之间有很大差别,上次刚学时编一个窗 ...

  8. Poj 2528 Mayor's posters 分类: Brush Mode 2014-07-23 09:12 84人阅读 评论(0) 收藏

    Mayor's posters Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 40570   Accepted: 11798 ...

  9. Poj 2349 Arctic Network 分类: Brush Mode 2014-07-20 09:31 93人阅读 评论(0) 收藏

    Arctic Network Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9557   Accepted: 3187 De ...

随机推荐

  1. css less

    LESSCSS是一种动态样式语言,属于CSS预处理语言的一种,它使用类似CSS的语法,为CSS的赋予了动态语言的特性,如变量.继承.运算.函数等,更方便CSS的编写和维护. LESSCSS可以在多种语 ...

  2. ofbiz进击 第六节。 --OFBiz配置之[widget.properties] 配置属性的分析

    配置内容分析如下 # -- 定义上下文使用者 -- security.context =default # -- 定义密码限制长度最小值 -- password.length.min =5 # -- ...

  3. hdu5255 魔法因子

    题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=5255 首先先预处理出一个p,使得p*因子X等于一个整数,且p最小,设q=p*X. 则题目则可以看成存在 ...

  4. BJFU 1009

    描述 现在社会上的抽奖活动简直是太多了.前段时间中国联通就举办了一个很无聊的抽奖活动,规则是每人可以向中国联通的短信系统发送一个实数,系统每天会从这些数字中选择一个无重复(就是有且只有一个)且最小的数 ...

  5. 安装交叉编译器arm-linux-gcc

    需要交叉编译环境故安装交叉编译环境    1.在宿主机的/usr/local/arm目录存放交叉编译器        mkdir /usr/local/arm    2.解压交叉编译器包至/usr/l ...

  6. asp.net中获得客户端的IP地址

    asp.net中获得客户端的IP地址 因为要在项目中取到客户端IP,在网上搜了下相关资料,其中有一篇文章总结的比较详细,这里就把一些我用的上总结一下 方便以后查阅.  通常我们都通过下面的代码获得IP ...

  7. sql server中index的REBUILD和REORGANIZE

    参考文献: http://technet.microsoft.com/en-us/library/ms188388.aspx 正文 本文主要讲解如何使用alter index来rebuild和reor ...

  8. 【NOIP模拟赛】lover——心上人

    心上人 [问题描述]  人到初三,总会遇到情感问题,比方说小 J 就喜欢上了小 W.于是小 J 就需要说一长串的话讨小 W 欢心.现在已知小 W 听到一些词就会很高兴,而且白听不厌,但她又讨厌小 J ...

  9. 【优化AC】建立联系

    建立联系 [试题描述] 新学期开始了,不料同学们在假期集体更换了电话,所以同学们只能重新建立联系. 班内一共有n位同学,他们一共建立了m次联系,老师想知道在同学们每次建立完一个联系后,一共有多少对同学 ...

  10. Android上传头像代码,相机,相册,裁剪

    activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout ...