0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-27 06:12:00 +00:00
OI-codes/Luogu/CF1573A/CF1573A.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;
}