Created
February 15, 2020 16:28
-
-
Save invatainfo/871e91eb611cd8ffc21c02432e0687aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string.h> | |
using namespace std; | |
int main() { | |
int i, n, x, a[100], pos = 0, exista_mari = 0, exista_mici = 0; | |
cin >> n >> x; | |
for (i = 0; i < n; i++) | |
cin >> a[i]; | |
for (i = 0; i < n; i++) { | |
if (a[i] >= x) { | |
int aux = a[i]; | |
a[i] = a[pos]; | |
a[pos] = aux; | |
pos++; | |
exista_mari = 1; | |
} else { | |
exista_mici = 1; | |
} | |
} | |
if (exista_mari == 0 || exista_mici == 0) { | |
cout << "nu exista" << endl; | |
return 0; | |
} | |
for (i = 0; i < n; i++) { | |
cout << a[i] << " "; | |
} | |
cout << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment