Source Code
#include <iostream>
#include <bits/stdc++.h> 
using namespace std;
long long t,a,sum;
int main()
{
    cin>>t;
    for(int i=0;i<t;i++){
        cin>>a;
        if(a > 9){
            while(a/10 > 0){
                a/=10;
            }
            sum+=a;
        }else{
           sum+=a; 
        }
    }
    cout<<sum;
    return 0;
}
Copy
The Tale of a Generous Prince sharawi
GNU G++17
50 ms
748 KB
Wrong Answer