EncodedSum
SRM 334 · 2007-01-13 · by Andrew_Lazarev
SRM 334 · 2007-01-13 · by Andrew_Lazarev · Math
Problem Statement
Problem Statement
You are given a
Constraints
- numbers will contain between 1 and 50 elements, inclusive.
- Each element of numbers will contain between 1 and 12 characters, inclusive.
- Each element of numbers will contain only uppercase letters between 'A' and 'J', inclusive.
- There will be at least one letter between 'A' and 'J', inclusive, that never occurs as the first character of any element of numbers.
Examples
0)
{"ABC",
"BCA"}
Returns: 1875
B = 9 A = 8 C = 7
1)
{"ABCDEFGHIJ"}
Returns: 9876543210
2)
{"ABCDEFGHIJ",
"J"}
Returns: 9876543202
We can not use J as 0. So, J = 1 I = 0
3)
{"A",
"BB",
"CCC",
"DDDD",
"EEEEE",
"FFFFFF",
"GGGGGGG",
"HHHHHHHH",
"IIIIIIIII",
"AJJJJJJJJJ"}
Returns: 9973936905
4)
{"J"}
Returns: 9
Submissions are judged against all 126 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Coding Area
Language: C++17 · define a public class EncodedSum with a public method long long maximumSum(vector<string> numbers) · 126 test cases · 2 s / 256 MB per case