Accepted
Code
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
int a[t];
for(int i=0;i<t;i++){
string s;
cin>>s;
int n=s.size();
int j=0,sum=0;
while(j<n){
if(s[j]>='0' && s[j]<='9'){
int b=s[j]-48;sum=sum+b;
}
j++;
}
a[i]=sum;
}
for(int i=0;i<t;i++)cout<<a[i]<<endl;
}
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 16:06:01
- Judged At
- 2024-11-11 03:24:46
- Judged By
- Score
- 100
- Total Time
- 1ms
- Peak Memory
- 324.0 KiB