From e3a09fd1513ace582cbeab8e0de94046b8d6d429 Mon Sep 17 00:00:00 2001 From: Justsvetoslavov Date: Mon, 25 Oct 2021 17:14:51 +0300 Subject: Fixed Limit. Fixed Loop --- pract_SI/pract. 03/Solutions/task7.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pract_SI/pract. 03/Solutions/task7.cpp') diff --git a/pract_SI/pract. 03/Solutions/task7.cpp b/pract_SI/pract. 03/Solutions/task7.cpp index b02cd7a..aa9194b 100644 --- a/pract_SI/pract. 03/Solutions/task7.cpp +++ b/pract_SI/pract. 03/Solutions/task7.cpp @@ -13,12 +13,12 @@ int main() unsigned long long N; cin >> N; - if (N <= LIMIT) + if (N < LIMIT) return -1; for (int c = 1; c <= N; c++) { - for (int b = 1; b <= c; b++) { - for (int a = 1; a <= b; a++) { + for (int b = 1; b < c; b++) { + for (int a = 1; a < b; a++) { if ((a * a) + (b * b) == (c * c)) { cout << a << SEPARATOR << b << SEPARATOR << c << endl; } -- cgit v1.3.1-23-gd82d