Accepted
Code
/**
* author: pollob18
* created: July 2024
**/
#include<bits/stdc++.h>
#define ll long long int
#define yes "YES"
#define no "NO"
#define nl "\n"
using namespace std;
void solution()
{
string s;
cin>>s;
int x=0;
for(int i=0;i<s.size();i++){
if(s[i]>='0' && s[i]<='9'){
x+=s[i]-'0';
}
}
cout<<x<<nl;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int tc;
cin>>tc;
while(tc--)
{
solution();
}
return 0;
}
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:35:42
- Judged At
- 2024-11-11 03:25:52
- Judged By
- Score
- 100
- Total Time
- 1ms
- Peak Memory
- 540.0 KiB