/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 1ms 440.0 KiB
#3 Accepted 1ms 324.0 KiB
#4 Accepted 1ms 324.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define OK ios_base::sync_with_stdio(0);  cin.tie(0); cout.tie(0);

#define en "\n"
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define sortall(a) sort(a.begin() , a.end() )
#define rsortall(a) sort(a.rbegin() , a.rend() )
#define all(a) a.begin() , a.end()
#define PI 2*acos(0.0)
#define pb push_back
# define ft    first
#define print(pr) for(int i=0;i<pr.size();i++)cout<<pr[i]<<" ";cout<<endl;
# define sn    second

//const ll mod =998244353;
ll mod=1e9+7;

/*masking..........

int n;
cin>>n;
ll x=0;
for(int i=0;i<n;i++)
{
    int k;
    cin>>k;
    x=(x | (1<<k));

}
bitset<sizeof(int) * 8> y(x);
cout<<y<<en;

masking...........
*/


// substr
// if (s2.find(s1) != string::npos)

// Graph Grid //
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};


ll N=1e6+7;





void lagacall()
{

  ll n;
//  cin>>n;
string a,aa;
cin>>a;
ll ans=0;
for(int i=0;i<a.size();i++)
{
    if(a[i]>='1' && a[i]<='9')
    {
        ans+=(a[i]-48);
    }
}
cout<<ans<<en;

}





int main()
{

    OK

int t,z=1;

cin>>t;
//t=1;


while(t--)
{

lagacall();

}
}





Information

Submit By
Type
Submission
Problem
P1072 Valuable digit
Contest
Brain Booster #4
Language
C++20 (G++ 13.2.0)
Submit At
2024-07-14 17:43:47
Judged At
2024-10-03 13:35:47
Judged By
Score
100
Total Time
1ms
Peak Memory
440.0 KiB