306331: CF1181B. Split a Number

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Split a Number

题意翻译

给你一个$l(2<=l<=100000)$位正整数$n$,将其划分成没有前导0的非空的两段,使这两段表示的正整数之和最小。数据保证至少有一个合法的划分。

题目描述

Dima worked all day and wrote down on a long paper strip his favorite number $ n $ consisting of $ l $ digits. Unfortunately, the strip turned out to be so long that it didn't fit in the Dima's bookshelf. To solve the issue, Dima decided to split the strip into two non-empty parts so that each of them contains a positive integer without leading zeros. After that he will compute the sum of the two integers and write it down on a new strip. Dima wants the resulting integer to be as small as possible, because it increases the chances that the sum will fit it in the bookshelf. Help Dima decide what is the minimum sum he can obtain.

输入输出格式

输入格式


The first line contains a single integer $ l $ ( $ 2 \le l \le 100\,000 $ ) — the length of the Dima's favorite number. The second line contains the positive integer $ n $ initially written on the strip: the Dima's favorite number. The integer $ n $ consists of exactly $ l $ digits and it does not contain leading zeros. Dima guarantees, that there is at least one valid way to split the strip.

输出格式


Print a single integer — the smallest number Dima can obtain.

输入输出样例

输入样例 #1

7
1234567

输出样例 #1

1801

输入样例 #2

3
101

输出样例 #2

11

说明

In the first example Dima can split the number $ 1234567 $ into integers $ 1234 $ and $ 567 $ . Their sum is $ 1801 $ . In the second example Dima can split the number $ 101 $ into integers $ 10 $ and $ 1 $ . Their sum is $ 11 $ . Note that it is impossible to split the strip into "1" and "01" since the numbers can't start with zeros.

Input

题意翻译

给你一个$l(2<=l<=100000)$位正整数$n$,将其划分成没有前导0的非空的两段,使这两段表示的正整数之和最小。数据保证至少有一个合法的划分。

加入题单

上一题 下一题 算法标签: