Accepted
Code
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(a) a.begin(),a.end()
#define endl '\n'
void solve()
{
string s;cin>>s;
ll ct=0;
for(auto x:s)
{
if(x>='0'&&x<='9')
{
ll tmp=x-'0';
ct+=tmp;
}
}
cout<<ct<<endl;
}
int main()
{
ios::sync_with_stdio(0); cin.tie(0);
ll t;cin>>t;
while(t--)
{
solve();
}
}
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 15:32:35
- Judged At
- 2024-11-11 03:26:02
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 540.0 KiB