diff --git a/src/main/cpp/t01_max3.cpp b/src/main/cpp/t01_max3.cpp index 5d09aaa2..9e8dbc65 100644 --- a/src/main/cpp/t01_max3.cpp +++ b/src/main/cpp/t01_max3.cpp @@ -18,5 +18,18 @@ using namespace std; int t01_max3() { + int a, b, c; + cin >> a >> b >> c; + if (a > b) + if (a > c) + cout << a; + else + cout << c; + else + if (b > c) + cout << b; + else + cout << c; + return 0; }; \ No newline at end of file diff --git a/src/main/cpp/t02_triangle.cpp b/src/main/cpp/t02_triangle.cpp index f50c09cb..c8a4312b 100644 --- a/src/main/cpp/t02_triangle.cpp +++ b/src/main/cpp/t02_triangle.cpp @@ -19,5 +19,12 @@ using namespace std; int t02_triangle() { + int a, b, c; + cin >> a >> b >> c; + if ((a + b > c) and (a + c > b) and (b + c > a)) + cout << "YES"; + else + cout << "NO"; + return 0; }; \ No newline at end of file diff --git a/src/main/cpp/t03_equal3.cpp b/src/main/cpp/t03_equal3.cpp index c9e661de..3bd7e024 100644 --- a/src/main/cpp/t03_equal3.cpp +++ b/src/main/cpp/t03_equal3.cpp @@ -19,5 +19,15 @@ using namespace std; int t03_equal3() { + int a, b, c; + cin >> a >> b >> c; + if ((a == c) and (b == c) and (a == b)) + cout << 3; + else + if ((a == b) or (a == c) or (b == c)) + cout << 2; + else + cout << 0; + return 0; }; \ No newline at end of file diff --git a/src/main/cpp/t04_chess_rook.cpp b/src/main/cpp/t04_chess_rook.cpp index fd6bb663..a4ed9f38 100644 --- a/src/main/cpp/t04_chess_rook.cpp +++ b/src/main/cpp/t04_chess_rook.cpp @@ -19,5 +19,12 @@ using namespace std; int t04_chess_rook() { + int a, b, c, d; + cin >> a >> b >> c >> d; + if ((a == c) or (b == d)) + cout << "YES"; + else + cout << "NO"; + return 0; }; \ No newline at end of file diff --git a/src/main/cpp/t05_chess_king.cpp b/src/main/cpp/t05_chess_king.cpp index e3f93bbd..b6c87539 100644 --- a/src/main/cpp/t05_chess_king.cpp +++ b/src/main/cpp/t05_chess_king.cpp @@ -20,5 +20,12 @@ using namespace std; int t05_chess_king() { + int a, b, a1, b1; + cin >> a >> b >> a1 >> b1; + if (abs(a - a1) <= 1 and abs(b - b1) <= 1) + cout << "YES"; + else + cout << "NO"; + return 0; }; \ No newline at end of file diff --git a/src/main/cpp/t06_chess_bishop.cpp b/src/main/cpp/t06_chess_bishop.cpp index cbcc1f36..cdc867f4 100644 --- a/src/main/cpp/t06_chess_bishop.cpp +++ b/src/main/cpp/t06_chess_bishop.cpp @@ -20,5 +20,12 @@ using namespace std; int t06_chess_bishop() { + int a1, b2, c1, d2; + cin >> a1 >> b2 >> c1 >> d2; + if (abs(a1 - c1) == abs(b2 - d2)) + cout << "YES"; + else + cout << "NO"; + return 0; }; \ No newline at end of file diff --git a/src/main/cpp/t07_chess_queen.cpp b/src/main/cpp/t07_chess_queen.cpp index c43f46dc..dbb557f6 100644 --- a/src/main/cpp/t07_chess_queen.cpp +++ b/src/main/cpp/t07_chess_queen.cpp @@ -29,5 +29,12 @@ using namespace std; int t07_chess_queen() { + int a, b, a1, b1; + cin >> a >> b >> a1 >> b1; + if ((a == a1) or (b == b1) or abs(a - a1) == abs(b - b1)) + cout << "YES"; + else + cout << "NO"; + return 0; }; \ No newline at end of file diff --git a/src/main/cpp/t08_chess_knight.cpp b/src/main/cpp/t08_chess_knight.cpp index f4b85cd9..de9e06d6 100644 --- a/src/main/cpp/t08_chess_knight.cpp +++ b/src/main/cpp/t08_chess_knight.cpp @@ -29,5 +29,12 @@ using namespace std; int t08_chess_knight() { + int a, b, a1, b1; + cin >> a >> b >> a1 >> b1; + if ((abs(a - a1) == 1 and abs(b - b1) == 2) or abs(a - a1) == 2 and abs(b - b1) == 1) + cout << "YES"; + else + cout << "NO"; + return 0; }; \ No newline at end of file diff --git a/src/main/cpp/t09_choco.cpp b/src/main/cpp/t09_choco.cpp index 33e51674..b289ec03 100644 --- a/src/main/cpp/t09_choco.cpp +++ b/src/main/cpp/t09_choco.cpp @@ -27,5 +27,12 @@ using namespace std; int t09_choco() { + int N, M, K; + cin >> N >> M >> K; + if ((K % N == 0 || K % M == 0) and ((N*M) > K)) + cout << "YES"; + else + cout << "NO"; + return 0; }; \ No newline at end of file diff --git a/src/main/cpp/t10_sort3.cpp b/src/main/cpp/t10_sort3.cpp index 7a8d2476..c39ae048 100644 --- a/src/main/cpp/t10_sort3.cpp +++ b/src/main/cpp/t10_sort3.cpp @@ -19,5 +19,13 @@ using namespace std; int t10_sort3() { + int A, B, C; + cin >> A >> B >> C; + int x; + if (A > B) { x = A; A = B; B = x; } + if (A > C) { x = A; A = C; C = x; } + if (B > C) { x = B; B = C; C = x; } + cout << A << " " << B << " " << C; + return 0; }; \ No newline at end of file diff --git a/src/main/cpp/t11_boxes.cpp b/src/main/cpp/t11_boxes.cpp index 3671cc32..96ddaebf 100644 --- a/src/main/cpp/t11_boxes.cpp +++ b/src/main/cpp/t11_boxes.cpp @@ -37,5 +37,22 @@ using namespace std; int t11_boxes() { + int A1, B1, C1, A2, B2, C2; + cin >> A1 >> B1 >> C1 >> A2 >> B2 >> C2; + int x; + if (A1 > B1) { x = A1; A1 = B1; B1 = x; } + if (A1 > C1) { x = A1; A1 = C1; C1 = x; } + if (B1 > C1) { x = B1; B1 = C1; C1 = x; } + + if (A2 > B2) { x = A2; A2 = B2; B2 = x; } + if (A2 > C2) { x = A2; A2 = C2; C2 = x; } + if (B2 > C2) { x = B2; B2 = C2; C2 = x; } + + if ((A1 == A2) && (B1 == B2) && (C1 == C2)) { cout << "Boxes are equal"; } + else if ((A1 <= A2) && (B1 <= B2) && (C1 <= C2)) { cout << "The first box is smaller than the second one"; } + else if ((A1 >= A2) && (B1 >= B2) && (C1 >= C2)) { cout << "The first box is larger than the second one"; } + else { cout << "Boxes are incomparable"; } + + return 0; }; \ No newline at end of file