mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-11-09 17:18:49 +00:00
CF1573A Countdown
R58498380
This commit is contained in:
parent
59c44b511e
commit
7482822f4c
22
Luogu/problem/CF1573A/CF1573A.cpp
Normal file
22
Luogu/problem/CF1573A/CF1573A.cpp
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user