Accepted
Code
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void solve() {
string s; cin >> s;
int ans = 0;
for (char c : s) {
if (c >= '1' and c <= '9') ans += c - '0';
}
cout << ans << "\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int tt = 1;
cin >> tt;
while (tt--) {
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 16:23:49
- Judged At
- 2024-11-11 03:24:14
- Judged By
- Score
- 100
- Total Time
- 2ms
- Peak Memory
- 532.0 KiB