CalcTest
SRM 246 · 2005-06-09 · by Andrew_Lazarev
Problem Statement
You are developing a new software calculator. During the testing phase of the software you have found that the test cases use different symbols as the decimal point of floating numbers. Moreover some test cases contain useless space symbols. Now you want to bring the numbers to a unified format.
You will be given a
Constraints
- numbers will have between 1 and 50 elements, inclusive.
- Each element of numbers will contain between 1 and 50 characters, inclusive.
- Each character in numbers will have ASCII code between 32 and 127, inclusive.
- Each element of numbers will contain at most one non-space non-digit symbol.
- Each element of numbers will contain at least one digit.
{"1.5", "2$ 3", "12 3"}
Returns: {"1.5", "2.3", "123" }
{",5", "3,", ".5", "3.", "000,000", "000 000"}
Returns: {".5", "3.", ".5", "3.", "000.000", "000000" }
{"263C45233 ", " 2364A56", "B273664"}
Returns: {"263.45233", "2364.56", ".273664" }
{"814777132","4/5","o216673","362521528","3","04"}
Returns: {"814777132", "4.5", ".216673", "362521528", "3", "04" }
{"19194939","17651J8192","\"52","6J0","1855213"," 19_9677"}
Returns: {"19194939", "17651.8192", ".52", "6.0", "1855213", "19.9677" }
Submissions are judged against all 53 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class CalcTest with a public method vector<string> uniform(vector<string> numbers) · 53 test cases · 2 s / 256 MB per case