Hello, Hello, my name is Dream ah , An interesting Python Blogger , Please go easy on me
2021 Blog star of the year TOP100,2021 Blog star of the year TOP5,Python Quality creators in the field , Welcome to cooperate with me ( At the end of the article VX Want to join the learning exchange group or Learning materials welcome +++)Introductory notes : This paradise never lacks genius , Hard work is your final ticket !
Last , May we all shine where we can't see , Let's make progress together
“ Ten thousand times sad , There will still be Dream, I've been waiting for you in the warmest place ”, It's me ! Ha ha ha ~
Preface :
【Python Training camp 】 Is aimed at Python A war created by language learning Brush questions and revel party! If you don't grasp the solid foundation of knowledge , Welcome to this course :Python Public class It's best to use it together ~ If you like, hurry up and subscribe ! If you don't have self-control or motivation to learn and communicate together , Welcome to send a private letter or add my... At the end of the text VX, I will pull you into the learning exchange group , Let's exchange and study together , Group punch in
Title Description
Given N Plus sign 、M A minus sign and N + M + 1 It's an integer , Xiao Ming wants to know at all by this N Plus sign 、MM A minus sign and N + M +1 It's legal to round it up In the suffix expression , Which is the biggest result ?
Please output this maximum result .
For example, using 1 2 3 + -, be “2 3 + 1 -” The result of this suffix expression is 4, It's the biggest .
Input description
The first line contains two integers N , M
The second line contains N + M + 1 It's an integer A .
Output description
Output an integer , For the answer .
I/o sample
Example
Input
1 1
1 2 3
Output
4
Operation limit
Maximum operation time :1s
Maximum running memory : 256M
At the beginning of this topic , We are also confused , How to discuss ± Parenthesized question , I have changed the example for several times and can't think of it , Until I found out Alex_996 It dawned on me , Here, I have learned from the experience of big men :2019 The 10th Blue Bridge Cup in - Provincial competition - C/C++ university B Group - I. Postfix expression
# Time : 2022/2/21 14:41
# File : Postfix expression .py
# Author : yes Dream ah !
# VX : Xu18300396393
# Ten thousand times sad , There will still be Dream, I've been waiting for you in the warmest place !
N,M = map(int,input().split())
list1 = list(map(int,input().split()))
if M == 0:
print(sum(list1))
else:
sum = 0
list1.sort()
for i in range(1,N+M):
sum += abs(list1[i])
sum += abs(list1[-1]-list1[0])
print(sum)
N,M = map(int,input().split())
Today is my day Python The first of the training camp 26 God , I hope to see the best of you every day
[Python Public class ] Zero base play Python The basic chapter ---- Section 1 :Python The introduction of
[Python Public class ] Zero base play Python Advanced ---- Section 1 :Python File operations in
Come on, let's have a problem swiping Carnival party Well !----【Python Training camp 】
All right. , That's all I want to share with you today
️️️ If you like , Don't be stingy with your one key triple connection ~