9492022-02-03 21:12:19nmarciSzámjegy keveréscpp11Accepted 40/403ms2000 KiB
#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <algorithm>
#include <list>
using namespace std;
using ll = long long int;

int main(){
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    ll answ = 0;
    if(s.size() > 1 && *s.rbegin() > '1' && s[s.size() - 2] == '0'){
        for(auto& i : s){
            if(i == '0'){
                i = '9';
            }
            else{
                --i;
            }
        }
        ++answ;
    }
    ll sum = 0;
    for(ll i = 0; i < s.size(); ++i){
        sum += atoi(s.substr(i,1).c_str());
    }
    answ += sum + ((s.size() - 1) * (s.size())) * 9 / 2;
    cout << answ << endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/02ms1740 KiB
2Accepted0/01ms1788 KiB
3Accepted0/01ms1844 KiB
4Accepted2/21ms1848 KiB
5Accepted2/21ms1868 KiB
6Accepted2/21ms1864 KiB
7Accepted2/21ms1868 KiB
8Accepted2/21ms1880 KiB
9Accepted2/21ms1876 KiB
10Accepted2/21ms1880 KiB
11Accepted4/41ms1884 KiB
12Accepted4/41ms1888 KiB
13Accepted2/22ms1924 KiB
14Accepted2/22ms1924 KiB
15Accepted2/22ms1936 KiB
16Accepted2/22ms1960 KiB
17Accepted2/22ms1960 KiB
18Accepted2/23ms1992 KiB
19Accepted3/32ms1984 KiB
20Accepted3/32ms2000 KiB