程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

How to solve the problem of Python?

編輯:Python

Xiao Ming is a thief with obsessive-compulsive disorder , He has excellent theft skills and is successful repeatedly . Xiao Ming is afraid of spending the rest of his life in prison , He's going to stop after this job .

There are n A house , The wealth value of each house is a[i], Xiao Ming hopes to be here n Steal as much value as possible from a house . Because some houses are in disrepair and other problems, Xiao Ming is at risk of injury when entering the house , So the value of wealth may be negative . Because Xiao Ming has obsessive-compulsive disorder , Every time he makes a move, he will only steal any continuous house , Xiao Ming chooses at least one house to steal .

Input format :
The first line is an integer n(1≤n≤1000000);

The second line n An integer represents the wealth value of each house ai.

Output format :
An integer in a row represents the maximum value Xiao Ming can steal .

sample input :
Here's a set of inputs . for example :

5
3 4 -1 4 -10
sample output :
Here is the corresponding output . for example :

10
Sample explanation
Xiao Ming steals 1-4 House No , Value is 3+4+(-1)+4=10


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved