首页 / 软件开发 / 数据结构与算法 / 算法题:UVA 11258 String Partition(dp)
算法题:UVA 11258 String Partition(dp)2014-04-12 csdn博客 accelerator_Problem F - String PartitionJohn 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?InputThe input begins with an integer N (≤ 500) which indicates the number of test cases followed. Each of the following test cases consists of a string of at most 200 digits.OutputFor each input, print out required answer in a single line.Sample input612345543215432112345000121212121212214748364811111111111111111111111111111111111111111111111111111Sample output1234554321543211239021212121242147483725555555666