Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

P3123 Kalenik Igor task 2 #498

Open
wants to merge 1 commit into
base: task-2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/main/cpp/t01_max3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
7 changes: 7 additions & 0 deletions src/main/cpp/t02_triangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
10 changes: 10 additions & 0 deletions src/main/cpp/t03_equal3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
7 changes: 7 additions & 0 deletions src/main/cpp/t04_chess_rook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
7 changes: 7 additions & 0 deletions src/main/cpp/t05_chess_king.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
7 changes: 7 additions & 0 deletions src/main/cpp/t06_chess_bishop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
7 changes: 7 additions & 0 deletions src/main/cpp/t07_chess_queen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
7 changes: 7 additions & 0 deletions src/main/cpp/t08_chess_knight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
7 changes: 7 additions & 0 deletions src/main/cpp/t09_choco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
8 changes: 8 additions & 0 deletions src/main/cpp/t10_sort3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
17 changes: 17 additions & 0 deletions src/main/cpp/t11_boxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};