Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- freopen("linobaci.in", "r", stdin);
- freopen("linobaci.out", "w", stdout);
- long long n, sum;
- scanf("%lld%lld", &n, &sum);
- long long l = 0, num;
- if(sum == 1)
- {
- for(l = 1; l < n; l++)
- {
- scanf("%d", &num);
- if(num > sum)
- {
- break;
- }
- else
- {
- sum += num;
- }
- }
- }
- printf("%d\n", l);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement