//查找a数组中,起始1和末尾1中的0的个数 voidsolve(){ int n; std::cin >> n; std::vector<int> a(n); for (int i = 0; i < n; i++) { std::cin >> a[i]; } int l = 0, r = n - 1; while (a[l] == 0) { l++; } while (a[r] == 0) { r--; } int ans = std::count(a.begin() + l, a.begin() + r, 0); std::cout << ans << "\n"; }