Skip to content
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
8 changes: 6 additions & 2 deletions src/main/cpp/t01_max3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@
using namespace std;

int t01_max3() {

};
int a,b,c;
cin >> a >> b >> c;
if (a>=b && a>=c) {cout << a;}
else if (b>=a && b>=c) cout << b;
else if (c>=a && c>=b) cout << c;
};
8 changes: 6 additions & 2 deletions src/main/cpp/t02_triangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,9 @@
using namespace std;

int t02_triangle() {

};
int A,B,C;
cin>>A>>B>>C;
if (A<(B+C) && B<(A+C) && C<(A+B))
cout<<"YES";
else cout<<"NO";
};
8 changes: 6 additions & 2 deletions src/main/cpp/t03_equal3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,9 @@
using namespace std;

int t03_equal3() {

};
int a,b,c;
cin>>a>>b>>c;
if (a==b && a==c && b==c) {cout<<3;} else
if (a==b || a==c || b==c) {cout<<2;} else
{cout<<0;}
};
8 changes: 6 additions & 2 deletions src/main/cpp/t04_chess_rook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,9 @@
using namespace std;

int t04_chess_rook() {

};
int x1,y1,x2,y2;
cin>>x1>>y1>>x2>>y2;
if (x1==x2 || y1==y2)
cout<<"YES";
else cout<<"NO";
};
8 changes: 6 additions & 2 deletions src/main/cpp/t05_chess_king.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,9 @@
using namespace std;

int t05_chess_king() {

};
int x1,y1,x2,y2;
cin>>x1>>y1>>x2>>y2;
if (abs(x1-x2)<2 && abs(y1-y2)<2)
cout<<"YES";
else cout<<"NO";
};
9 changes: 7 additions & 2 deletions src/main/cpp/t06_chess_bishop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,10 @@
using namespace std;

int t06_chess_bishop() {

};
int x1, x2, y1, y2;
cin >> x1 >> y1 >> x2 >> y2;
if (abs(x1 - x2) == abs(y1 - y2))
cout << "YES";
else
cout << "NO";
};
9 changes: 7 additions & 2 deletions src/main/cpp/t07_chess_queen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,10 @@
using namespace std;

int t07_chess_queen() {

};
int x1, x2, y1, y2;
cin >> x1 >> y1 >> x2 >> y2;
if (abs(x1 - x2) == abs(y1 - y2) || x1 == x2 || y1 == y2)
cout << "YES";
else
cout << "NO";
};
8 changes: 6 additions & 2 deletions src/main/cpp/t08_chess_knight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@
using namespace std;

int t08_chess_knight() {

};
int x1, x2, y1, y2;
cin >> x1 >> y1 >> x2 >> y2;
if (abs(x1 - x2) == 1 && abs(y1 - y2) == 2 || abs(x1 - x2) == 2 && abs(y1 - y2) == 1)
cout << "YES";
else cout << "NO";
};
9 changes: 7 additions & 2 deletions src/main/cpp/t09_choco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,10 @@
using namespace std;

int t09_choco() {

};
int N, M, K;
cin >> N >> M >> K;
if (K < N * M && ((K % N == 0) || (K % M == 0)))
cout << "YES";
else
cout << "NO";
};
11 changes: 9 additions & 2 deletions src/main/cpp/t10_sort3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,12 @@
using namespace std;

int t10_sort3() {

};
int a,b,c;
cin>>a>>b>>c;
if (a>=b && a>=c && b>=c) cout<<c<<" "<<b<<" "<<a;
else if (a>=b && a>=c && b<=c) cout<<b<<" "<<c<<" "<<a;
else if (b>=a && b>=c && a>=c) cout<<c<<" "<<a<<" "<<b;
else if (b>=a && b>=c && a<=c) cout<<a<<" "<<c<<" "<<b;
else if (c>=b && c>=a && b>=a) cout<<a<<" "<<b<<" "<<c;
else if (c>=b && a<=c && b<=a) cout<<b<<" "<<a<<" "<<c;
};
48 changes: 46 additions & 2 deletions src/main/cpp/t11_boxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,49 @@
using namespace std;

int t11_boxes() {

};
int a1,b1,c1,a2,b2,c2;
cin >> a1 >> b1 >> c1 >> a2 >> b2 >> c2;
if ( a1 > b1 ) {
int temp;
temp = a1;
a1 = b1;
b1 = temp;
}
if ( a1 > c1 ) {
int temp;
temp = a1;
a1 = c1;
c1 = temp;
}
if ( b1 > c1 ) {
int temp;
temp = b1;
b1 = c1;
c1 = temp;
}
if ( a2 > b2 ) {
int temp;
temp = a2;
a2 = b2;
b2 = temp;
}
if ( a2 > c2 ) {
int temp;
temp = a2;
a2 = c2;
c2 = temp;
}
if ( b2 > c2 ) {
int temp;
temp = b2;
b2 = c2;
c2 = temp;
}

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";
};