0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-12 16:26:26 +00:00
OI-codes/Luogu/CF1573A/CF1573A.cpp

23 lines
380 B
C++

#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;
}