Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdexcept>
- using namespace std;
- bool solution(int n, int a[]) {
- for (int i = 0; i < n; i++)
- if (a[i] > 1000) return 1;
- return 0;
- }
- void test_if_more() {
- int test[4] = {1, 2, 4, 1000000000};
- if (solution(4, test) != 1) {
- throw invalid_argument( "naurrrwww хуйня неправда дано больше сказал что не нашел" );
- }
- }
- void test_if_less() {
- int test[4] = {1, 2, 4, 5};
- if (solution(4, test) != 0) {
- throw invalid_argument( "naurrrwww хуйня неправда ожидалось 0 вернул 1" );
- }
- }
- int main() {
- test_if_more();
- test_if_less();
- int n;
- cin >> n;
- int a[n];
- for (int i = 0; i < n; i++) cin >> a[i];
- cout << solution(n, a);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement