Conglutination
SRM 246 · 2005-06-09 · by Andrew_Lazarev
Problem Statement
You are developing a new software calculator. Some people use the calculator to check the sums of several numbers, but they sometimes get unexpected results because they forget to press the 'plus' button. You have almost solved this problem, but a small method is still required.
You will be given a
Constraints
- conglutination will contain between 2 and 20 characters, inclusive.
- conglutination will contain only digits ('0'-'9').
- The first character of conglutination will not be zero.
- expectation will be between 1 and 1000000000, inclusive.
"22" 4 Returns: "2+2"
"536" 41 Returns: "5+36"
"123456000789" 1235349 Returns: "1234560+00789"
Be careful with leading zeros.
"123456789" 4245 Returns: ""
"112" 13 Returns: "1+12"
The value of A should be as small as possible.
Submissions are judged against all 87 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class Conglutination with a public method string split(string conglutination, int expectation) · 87 test cases · 2 s / 256 MB per case