Maxmatqulov Mashrabbek SWD007_L2 Saidov Samandar Muzzafarovich
7.Navbat eng kichik elementi o`chirilsin
#include
#include
using namespace std;
int main()
{
queue qu;
queue qu2;
int n;
cin >> n;
for(int i=0, a; i {
cin >> a;
qu.push(a);
qu2.push(a);
}
//Maxmatqulov//
const int& k = qu2.front();
int min = k;
for(int i=0; i {
if(qu2.front() < min) min = qu2.front();
qu2.pop();
}
cout << "min=" << min << endl;
for(int i=0; i {
if(qu.front() == min)
{
qu.pop();
continue;
}
qu2.push(qu.front());
qu.pop();
}
n = qu2.size(); //Maxmatqulov//
for(int i=0; i {
cout << qu2.front() << " "; qu2.pop();
}
}
Do'stlaringiz bilan baham: |