原题链接:https://codeforces.com/contest/1705/problem/B
这是我的代码,已经尝试和题解与std比对了,找不到问题,求问/kk
#include <iostream>
using namespace std;
#define MAX_N 200010
#define int long long
int n,a[MAX_N];
signed main(){
int t;
cin >> t;
while(t--){
cin >> n;
for(int i = 1;i <= n;i++)cin >> a[i];
int start = 0;
for(int i = 1;i <= n;i++)
if(a[i] != 0)start = i,i = n + 1;
// cout << start << endl;
int x = 0,t = 0;
for(int i = start;i < n;++i){
t += a[i];
if(a[i] == 0)x++;
}
cout << t + x << endl;
}
return 0;
}