0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-25 20:12:07 +00:00
OI-codes/Codeforces/1573/A/A.cpp

23 lines
380 B
C++
Raw Normal View History

2021-09-24 13:13:33 +00:00
#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;
}