Definition at line 7 of file main.cpp.
◆ getLucky()
| int Solution::getLucky |
( |
string |
s, |
|
|
int |
k |
|
) |
| |
|
inline |
Definition at line 35 of file main.cpp.
36 {
37 vector<ll> array(s.size());
38 for (int i = 0; i < (int)s.size(); ++i)
39 array[i] = s[i] - 'a' + 1;
40
42
43 for (int i = 0; i < k - 1; ++i)
45
46 return (int)sum;
47 }
ll sum_array_digits(const vector< ll > &array)
References sum_array_digits(), and transform_sum().
Referenced by main().
◆ sum_array_digits()
| ll Solution::sum_array_digits |
( |
const vector< ll > & |
array | ) |
|
|
inline |
Definition at line 10 of file main.cpp.
11 {
14 {
15 while (el > 0)
16 {
17 sum += el % 10;
18 el /= 10;
19 }
20 }
21 return sum;
22 }
Referenced by getLucky().
◆ transform_sum()
| ll Solution::transform_sum |
( |
ll |
sum | ) |
|
|
inline |
Definition at line 24 of file main.cpp.
25 {
27 while (sum > 0)
28 {
29 new_sum += sum % 10;
30 sum /= 10;
31 }
32 return new_sum;
33 }
Referenced by getLucky().
The documentation for this class was generated from the following file: