14512022-10-10 18:42:19lacitoSzámjegy keveréscpp11Wrong answer 33/403ms3192 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    string s;
    cin >> s;
    bool van = false;
    long long muvdb = 0;
    for (int i = s.length()-1; i >= 0; i--)
    {
        if (!van && s[i] - '0' != 0 && i != 0) {
            van = true;
        }
        muvdb += s[i] - '0';
    }
    if (!van) {
        muvdb = s[0] - '0' + 9 * (s.length() - 1);
    }
    long long ossz = 0;
    for (int i = 1; i <= s.length() - 1; i++) {
        ossz += i;
    }
    cout << muvdb + 9 * ossz;
}

// 999 >> 991 >> 199 >> 190 >> 109 >> 100 >> 99
SubtaskSumTestVerdictTimeMemory
base33/40
1Accepted0/03ms1684 KiB
2Accepted0/02ms1932 KiB
3Accepted0/02ms1924 KiB
4Accepted2/22ms2056 KiB
5Accepted2/22ms2296 KiB
6Accepted2/22ms2492 KiB
7Accepted2/22ms2668 KiB
8Wrong answer0/22ms2748 KiB
9Accepted2/22ms2740 KiB
10Accepted2/22ms2736 KiB
11Accepted4/42ms2736 KiB
12Accepted4/42ms2872 KiB
13Accepted2/22ms2960 KiB
14Accepted2/22ms2968 KiB
15Wrong answer0/22ms2964 KiB
16Accepted2/22ms2972 KiB
17Accepted2/22ms2964 KiB
18Accepted2/22ms3192 KiB
19Wrong answer0/32ms3168 KiB
20Accepted3/32ms3172 KiB