#C11095. Maximum Pleasure Value
Maximum Pleasure Value
Maximum Pleasure Value
You are given an integer k
and a non-empty string s
. In one operation, you gain a pleasure value equal to the length of the string. You must perform exactly k
operations. The goal is to compute the maximum possible total pleasure value you can obtain.
The total pleasure value is computed as:
where \(|s|\) denotes the length of the string s
.
For example, if k = 2
and s = "abcde"
then the total pleasure value is 2 \times 5 = 10
.
inputFormat
The input is given via standard input in the following format:
Line 1: An integerk
representing the number of operations. Line 2: A strings
whose length contributes to the pleasure value per operation.
outputFormat
Output a single integer which is the maximum total pleasure value obtained after performing exactly k
operations.
The output should be printed to standard output.
## sample2
abcde
10