9482022-02-03 21:10:26nmarciSzámjegy keveréscpp11Wrong answer 32/402ms1996 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
base32/40
1Accepted0/02ms1744 KiB
2Accepted0/01ms1784 KiB
3Accepted0/01ms1844 KiB
4Accepted2/22ms1848 KiB
5Accepted2/21ms1852 KiB
6Accepted2/21ms1856 KiB
7Accepted2/21ms1864 KiB
8Accepted2/21ms1860 KiB
9Accepted2/21ms1864 KiB
10Accepted2/21ms1872 KiB
11Accepted4/41ms1876 KiB
12Wrong answer0/41ms1880 KiB
13Accepted2/22ms1904 KiB
14Accepted2/22ms1920 KiB
15Accepted2/22ms1932 KiB
16Wrong answer0/22ms1944 KiB
17Wrong answer0/22ms1956 KiB
18Accepted2/22ms1964 KiB
19Accepted3/32ms1980 KiB
20Accepted3/32ms1996 KiB