#include <iostream> #include <cmath> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int M[500000]; int n, i, poloczenia = 0, l, l1, p, r, sum, pom; long long suma = 0; cin >> n; return 0; for (i = 0; i < n; i++) { cin >> M[i]; suma += M[i]; } if (suma >= 0) { } else { cout << -1; } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include <iostream> #include <cmath> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int M[500000]; int n, i, poloczenia = 0, l, l1, p, r, sum, pom; long long suma = 0; cin >> n; return 0; for (i = 0; i < n; i++) { cin >> M[i]; suma += M[i]; } if (suma >= 0) { } else { cout << -1; } } |