9182022-01-28 09:59:07kicsiboglarSzámjegy keveréscpp11Accepted 40/402ms2112 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define ll long long 
using namespace std;

ll  i, j, k=0;
string s;
int main()
{
    ios::sync_with_stdio(false);
    cin >> s;
    for (i = 0; i < s.size(); ++i)
    {
        j += (s[i] - 48);
        if (s[i] != 48) k++;
    }
    ll db = s.size();
    if (k == 1 && s[0]!=49)
    {
        j += (db - 1) * 9;
    }
    
    cout << j + (((db - 1) * db) / 2) * 9;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/02ms1868 KiB
2Accepted0/01ms1940 KiB
3Accepted0/01ms1944 KiB
4Accepted2/21ms1956 KiB
5Accepted2/21ms1960 KiB
6Accepted2/21ms1956 KiB
7Accepted2/21ms1952 KiB
8Accepted2/21ms1956 KiB
9Accepted2/21ms1968 KiB
10Accepted2/21ms1980 KiB
11Accepted4/41ms1968 KiB
12Accepted4/41ms1988 KiB
13Accepted2/21ms2008 KiB
14Accepted2/21ms2044 KiB
15Accepted2/21ms2016 KiB
16Accepted2/21ms2052 KiB
17Accepted2/21ms2080 KiB
18Accepted2/21ms2080 KiB
19Accepted3/32ms2104 KiB
20Accepted3/31ms2112 KiB