0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-09-19 17:05:25 +00:00

CF1573A Countdown

R58498380
This commit is contained in:
Baoshuo Ren 2021-09-24 21:13:33 +08:00 committed by Baoshuo Ren
parent 59c44b511e
commit 7482822f4c
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

View File

@ -0,0 +1,22 @@
#include <bits/stdc++.h>
using namespace std;
int t, n, ans;
string s;
int main() {
cin >> t;
while (t--) {
ans = 0;
cin >> n >> s;
for (int i = 0; i < s.size(); i++) {
if (s[i] != '0') {
ans += s[i] - '0';
ans += i != n - 1;
}
}
cout << ans << endl;
}
return 0;
}