Accepted
Code
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long int
#define lld long long double
#define ull unsigned long long
void solve(){
string s;
cin >> s;
ll sum = 0;
for (int i = 0; i < s.length(); i++){
if (s[i] >= '0' && s[i] <= '9'){
sum += s[i] - '0';
}
}
cout << sum << endl;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int 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:33:03
- Judged At
- 2024-11-11 03:25:58
- Judged By
- Score
- 100
- Total Time
- 1ms
- Peak Memory
- 532.0 KiB