mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-26 05:32:03 +00:00
23 lines
380 B
C++
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;
|
|
}
|