为什么83分

tctm169 我以逍遥醉人间 2024-07-28 16:00:44 3

#include <bits/stdc++.h> #include #include #include #include #include #include #include #include using namespace std; int n, b, sum; int a[10000000]; int main() { cin >> n >> b; for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 1; i <= n; i++) { sum += a[i]; if (sum >= b) { cout << i; return 0; } } cout << -1; }

{{ vote && vote.total.up }}