武大校赛资格赛 差值维护
发布日期:2021-10-08 15:48:47 浏览次数:9 分类:技术文章

本文共 1134 字,大约阅读时间需要 3 分钟。

Problem 1565 - B - Magic
Description
Here are n numbers.
You have a magic first , you choose a interval [l,r],and then each Si(l<=i<=r) will be ( 10 – Si ) % 10.
You can use the magic at most once to make sum of all the numbers to be maximum.
What is the maximum sum you can get?
Input
First line of each case contains a number n.(1 ≤  n ≤ 1 000 000).
Next line contains n numbers without space-separated. Each position corresponds to a number of 0-9.
Output
Output the answer on a single line for each case.
Sample Input
10
3775053808
10
2580294019
10
4701956095
Sample Output

50

50
54

#include 
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;typedef long long LL;const int INF = 0x4fffffff;const double EXP = 1e-5;const int MS = 1000005;const int SIZE = 100005;int num[MS];int s[MS];char str[MS];int main(){ int n; while(cin>>n) { // cin>>n; cin>>str; int sum=0; int ans=0; int total=0; // s[0]=0; // int ss,tt; for(int i=0;i
ans) { ans=sum; // tt=i; } } // cout<
<

 

转载地址:https://blog.csdn.net/ONE_PIECE_HMH/article/details/45130997 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:武大校赛资格赛 最小矩阵覆盖
下一篇:编程之美回文字符串,DP

发表评论

最新留言

留言是一种美德,欢迎回访!
[***.207.175.100]2024年04月02日 08时53分27秒