22862023-01-09 13:11:09rennSzámjegy keveréscpp11Wrong answer 32/403ms4120 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    cin.tie(0);
    iostream::sync_with_stdio(0);
    
    string s;
    cin >> s;
    
    if(s.size() == 1){
        cout << s << "\n";
        return 0;
    }
    
    long long ki = 0;
    long long sum;
    for(char c : s){
        ki += c-'0';
    }
    int hossz = s.size()-1;
        
    while(hossz > 0){
        sum = 9*hossz;
        ki += sum;
        hossz--;
    }
    
    cout << ki << "\n";
    
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base32/40
1Accepted0/03ms1832 KiB
2Accepted0/02ms2052 KiB
3Accepted0/02ms2224 KiB
4Accepted2/22ms2428 KiB
5Accepted2/22ms2632 KiB
6Accepted2/22ms2832 KiB
7Accepted2/22ms3044 KiB
8Accepted2/22ms3240 KiB
9Accepted2/22ms3316 KiB
10Accepted2/22ms3424 KiB
11Accepted4/42ms3320 KiB
12Wrong answer0/42ms3316 KiB
13Accepted2/22ms3344 KiB
14Accepted2/22ms3340 KiB
15Accepted2/22ms3472 KiB
16Wrong answer0/22ms3548 KiB
17Wrong answer0/22ms3544 KiB
18Accepted2/22ms3676 KiB
19Accepted3/32ms3800 KiB
20Accepted3/32ms4120 KiB