Skip to content

Adding a tutorial for dimik-small-to-large #484

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
24 changes: 24 additions & 0 deletions dimik-small-to-large/en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Dimik - Small to Large

In this problem, you will be given `T` testcases. Each line of the testcase consists of 3 distinct integers denoted by `n1`,`n2` and `n3`. We have to print these 3 integers in ascending order putting empty space between each two consecutive numbers.

### Solution
We can find the solution by either using the `if else` statement to find the minimum, second minimum and consequently the third minimum and then print the three numbers in order or we can store the three numbers in an array and sort them using the `sort()` function and print accordingly.

### C++
```cpp
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
for (int k = 1; k <= t; k++)
{
int a[3];
cin >> a[0] >> a[1] >> a[2];
sort(a, a + 3);
cout << "Case " << k << ": " << a[0] << " " << a[1] << " " << a[2] << endl;
}
}
```