当前位置:网站首页>Codeforces Round #274 (Div. 2) –A Expression
Codeforces Round #274 (Div. 2) –A Expression
2022-07-06 21:58:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm the king of the whole stack .
Topic links :Expression
Expression
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard 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
3output
9input
2
10
3output
60General meaning :a, b, c Three numbers . Among the three numbers , Insert “+” and “*” Any two combinations of operators , Find the maximum value of the expression composed of energy .( Can use brackets )
Their thinking : Nothing to say. . Direct violence , All in all 6 Combinations of .
AC Code :
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
#define INF 0x7fffffff
int x[9];
int main()
{
// #ifdef sxk
// freopen("in.txt","r",stdin);
// #endif
int a,b,c;
while(scanf("%d%d%d",&a,&b,&c)!=EOF)
{
x[0] = a + b + c;
x[1] = a + (b * c);
x[2] = a * (b + c);
x[3] = (a + b) * c;
x[4] = (a * b) + c;
x[5] = a * b * c;
sort(x, x+6);
printf("%d\n",x[5]);
}
return 0;
}Copyright notice : this paper sxk Original article . Reprint this article , Please add a link ^_^
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/117058.html Link to the original text :https://javaforall.cn
边栏推荐
- [Yu Yue education] reference materials for surgical skills teaching in Tongji University
- Make menuconfig has a recipe for target 'menuconfig' failed error
- [Li Kou brush questions] 32 Longest valid bracket
- 1292_FreeROS中vTaskResume()以及xTaskResumeFromISR()的实现分析
- 在Pi和Jetson nano上运行深度网络,程序被Killed
- 抖音将推独立种草App“可颂”,字节忘不掉小红书?
- C how to set two columns comboboxcolumn in DataGridView to bind a secondary linkage effect of cascading events
- Quick access to video links at station B
- [go][reprint]vscode run a HelloWorld example after configuring go
- 小满网络模型&http1-http2 &浏览器缓存
猜你喜欢

Digital transformation takes the lead to resume production and work, and online and offline full integration rebuilds business logic

JPEG2000 matlab source code implementation

华为在多个行业同时出击,吓人的技术让欧美企业瑟瑟发抖

20 large visual screens that are highly praised by the boss, with source code templates!
![[Li Kou brush questions] 32 Longest valid bracket](/img/51/1ce4f9e8517dba214ec82b6567c923.png)
[Li Kou brush questions] 32 Longest valid bracket

Basic introduction of figure
![Some problems about the use of char[] array assignment through scanf..](/img/cf/d85a3172c5d29ac00377f9c30dbc4f.png)
Some problems about the use of char[] array assignment through scanf..
![关于char[]数组通过scanf赋值使用上的一些问题。。](/img/cf/d85a3172c5d29ac00377f9c30dbc4f.png)
关于char[]数组通过scanf赋值使用上的一些问题。。

Persistence / caching of RDD in spark

Tiktok will push the independent grass planting app "praiseworthy". Can't bytes forget the little red book?
随机推荐
HDU 2008 数字统计
uni-app App端半屏连续扫码
Aggregate function with key in spark
LeetCode:1189. The maximum number of "balloons" -- simple
LeetCode学习记录(从新手村出发之杀不出新手村)----1
string的底层实现
Record the process of cleaning up mining viruses
爬虫实战(五):爬豆瓣top250
基于InsightFace的高精度人脸识别,可直接对标虹软
1292_ Implementation analysis of vtask resume() and xtask resume fromisr() in freeros
Microsoft technology empowerment position - February course Preview
[Li Kou brushing questions] one dimensional dynamic planning record (53 change exchanges, 300 longest increasing subsequence, 53 largest subarray and)
11、 Service introduction and port
Sql: stored procedures and triggers - Notes
Intelligent online customer service system source code Gofly development log - 2 Develop command line applications
Solution to the problem of UOS boot prompt unlocking login password ring
袁小林:安全不只是标准,更是沃尔沃不变的信仰和追求
Is it important to build the SEO foundation of the new website
MPLS experiment
MySQL related terms