mirror of
https://github.com/tiennm99/codeforces.git
synced 2026-06-09 16:13:53 +00:00
[Init] Solved solutions
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#define MAX_SIZE 100
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
string s;
|
||||
stringstream ss;
|
||||
getline(cin, s);
|
||||
ss.str(s);
|
||||
int arr[MAX_SIZE];
|
||||
char c;
|
||||
int n = 0;
|
||||
while(!ss.eof())
|
||||
{
|
||||
ss >> arr[n++] >> c;
|
||||
}
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
for (int j = i + 1; j < n; j++)
|
||||
{
|
||||
if (arr[j] < arr[i])
|
||||
{
|
||||
int temp = arr[i];
|
||||
arr[i] = arr[j];
|
||||
arr[j] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
cout << arr[i];
|
||||
if (i != n - 1)
|
||||
{
|
||||
cout << '+';
|
||||
}
|
||||
}
|
||||
cout << endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user