/ SeriousOJ /

Record Detail

Accepted


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

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