22872023-01-09 13:12:02rennSzámjegy keveréscpp11Wrong answer 32/403ms3424 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';
    }
    long long hossz = s.size()-1;
        
    while(hossz > 0){
        sum = 9*hossz;
        ki += sum;
        hossz--;
    }
    
    cout << ki << "\n";
    
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base32/40
1Accepted0/03ms1828 KiB
2Accepted0/02ms2024 KiB
3Accepted0/02ms2224 KiB
4Accepted2/22ms2452 KiB
5Accepted2/22ms2656 KiB
6Accepted2/22ms2860 KiB
7Accepted2/22ms2936 KiB
8Accepted2/22ms3020 KiB
9Accepted2/22ms3248 KiB
10Accepted2/22ms3220 KiB
11Accepted4/42ms3240 KiB
12Wrong answer0/42ms3316 KiB
13Accepted2/22ms3348 KiB
14Accepted2/22ms3344 KiB
15Accepted2/22ms3420 KiB
16Wrong answer0/22ms3420 KiB
17Wrong answer0/22ms3420 KiB
18Accepted2/22ms3420 KiB
19Accepted3/32ms3416 KiB
20Accepted3/32ms3424 KiB