g453. 11258: String Partition
標籤 :
通過比率 : 28人/30人 ( 93% ) [非即時]
評分方式:
Tolerant

最近更新 : 2023-08-18 12:43

內容

John was absurdly busy for preparing a programming contest recently. He wanted to create a ridiculously easy problem for the contest. His problem was not only easy, but also boring: Given a list of non-negative integers, what is the sum of them? However, he made a very typical mistake when he wrote a program to generate the input data for his problem. He forgot to print out spaces to separate the list of integers. John quickly realized his mistake after looking at the generated input file because each line is simply a string of digits instead of a list of integers. He then got a better idea to make his problem a little more interesting: There are many ways to split a string of digits into a list of non-zero-leading (0 itself is allowed) 32-bit signed integers. What is the maximum sum of the resultant integers if the string is split appropriately?

輸入說明

The input begins with an integer N $(\leq 500)$ which indicates the number of test cases followed. Each of the following test cases consists of a string of at most 200 digits.

輸出說明

For each input, print out required answer in a single line.

範例輸入 #1
6
1234554321
5432112345
000
121212121212
2147483648
11111111111111111111111111111111111111111111111111111
範例輸出 #1
1234554321
543211239
0
2121212124
214748372
5555555666
測資資訊:
記憶體限制: 512 MB
不公開 測資點#0 (10%): 1.0s , <1K
不公開 測資點#1 (10%): 1.0s , <1K
不公開 測資點#2 (10%): 1.0s , <1M
不公開 測資點#3 (10%): 1.0s , <1M
不公開 測資點#4 (10%): 1.0s , <1M
不公開 測資點#5 (10%): 1.0s , <1M
不公開 測資點#6 (10%): 1.0s , <1M
不公開 測資點#7 (10%): 1.0s , <1M
不公開 測資點#8 (10%): 1.0s , <1M
不公開 測資點#9 (10%): 1.0s , <1M
提示 :

測資為隨機產生,若有錯誤歡迎提出

標籤:
出處:
UVA11258CPE第六題 [管理者: fire5386 (becaidorz) ]

本題狀況 本題討論 排行

編號 身分 題目 主題 人氣 發表日期
沒有發現任何「解題報告」