#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a[10];
int n;
cin>>n;
for(int i = 0;i<n;i++)
{
cin>>a[i];
}
for(int i = 0;i<n-1;i++)
{
for(int j = 0;j<n-i-1;j++)
{
if(a[j]>a[j+1])
{
int tmp = a[j];
a[j] = a[j+1];
a[j+1] = tmp;
}
}
}
for(int i = 0;i<n;i++)
{
cout<<a[i]<<" ";
}
return 0;
}
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int a[10];
int n;
cin>>n;
for(int i = 0;i<n;i++)
{
cin>>a[i];
}
for(int i = 0;i<n-1;i++)
{
for(int j = 0;j<n-i-1;j++)
{
if(a[j]%10>a[j+1]%10)
{
int tmp = a[j];
a[j] = a[j+1];
a[j+1] = tmp;
}
else if(a[j]%10 == a[j+1]%10)
{
if(a[j]>a[j+1])
{
int tmp = a[j];
a[j] = a[j+1];
a[j+1] = tmp;
}
}
}
}
for(int i = 0;i<n;i++)
{
cout<<a[i]<<" ";
}
return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a[10];
int n,m;
cin>>n>>m;
for(int i = 0;i<n;i++)
{
cin>>a[i];
}
for(int i = 0;i<n-1;i++)
{
for(int j = 0;j<=n-1-i;j++)
{
if(a[j]<a[j+1])
{
int tmp = a[i];
a[j] = a[j+1];
a[j+1] = tmp;
}
else if(a[j]%10 == a[j+1]%10)
{
if(a[j]>a[j+1])
{
int tmp=a[j];
a[j]=a[j+1];
a[j+1]=tmp;
}
}
}
}
for(int i = 0;i<n;i++)
{
cout<<a[i]<<" ";
}
return 0;
}
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int a[10];
int n = 0,s;
cin>>s;
for(int i = 0;i<n;i++)
{
cin>>a[i];
}
int tmp;
cin>>tmp;
for(int i = 0;i<s;i++)
{
if(tmp%2 == 1)
{
a[n] = tmp;
n++;
}
}
for(int i = 0;i<n-1;i++)
{
for(int j = 0;j<n-1-i;j++)
{
if(a[j]>a[j+1])
{
int tmp = a[j];
a[j] = a[j+1];
a[j+1] = tmp;
}
}
}
for(int i = 0;i<n-1;i++)
{
cout<<a[i]<<",";
}
cout<<a[n-1];
return 0;
}
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int a[10];
int n,k;
cin>>n>>k;
for(int i = 0;i<n;i++)
{
cin>>a[i];
for(int i = 0;i<n-1;i++)
{
for(int j = 0;j<n-1-i;j++)
{
if(a[j]%2 == 0&&a[j+1]%2 == 1)
{
int tmp = a[j];
a[j] = a[j+1];
a[j+1] = tmp;
}
else if(a[j]%2 == 0&&a[j+1]%2 == 1&&a[j]<a[j+1])
{
int tmp = a[j];
a[j] = a[j+1];
a[j+1] = tmp;
}
else if(a[j]%2 == 0&&a[j+1]%2 == 1&&a[j]>a[j+1])
{
int tmp = a[j];
a[j] = a[j+1];
a[j+1] = tmp;
}
}
}
}
for(int i = 0;i<n;i++)
{
cout<<a[i]<<" ";
}
return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a[10];
int n,k;
cin>>n>>k;
for(int i = 0;i<n;i++)
{
cin>>a[i];
}
for(int i = 0;i<n-1;i++)
{
for(int j = 0;j<=n-1-i;j++)
{
if(a[j]<a[j+1])
{
int tmp = a[i];
a[j] = a[j+1];
a[j+1] = tmp;
}
}
}
for(int i=0;i<n;i++)
{
if(i==k-1)
{
cout<<a[i];
}
}
return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a[10];
int n;
cin>>n;
double v;
for(int i = 0;i<n;i++)
{
cin>>a[i];
}
for(int i = 0;i<n-1;i++)
{
for(int j = 0;j<n-i-1;j++)
{
if(a[j]>a[j+1])
{
int tmp = a[j];
a[j] = a[j+1];
a[j+1] = tmp;
}
}
}
if(n%2!=0)
{
v = a[n/2];
}
else
{
v = (a[n/2] + a[n/2-1])/2.0;
}
cout<<fixed<<setprecision(1)<<v<<endl;
return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a[10];
int n;
cin>>n;
for(int i = 0;i<n;i++)
{
cin>>a[i];
}
for(int i = 0;i<n-1;i++)
{
for(int j = 0;j<n-i-1;j++)
{
if(a[j]>a[j+1])
{
int tmp = a[j];
a[j] = a[j+1];
a[j+1] = tmp;
}
}
}
int sum = a[1]+a[2]+a[3]+a[4]+a[5];
cout<<sum*1.0/5;
return 0;
}
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
int a[10];
int n;
cin>>n;
for(int i = 0;i<n;i++)
{
cin>>a[i];
}
int x;
cin>>x;
for(int i = 0;i<n-1;i++)
{
for(int j = 0;j<n-1-i;j++)
{
if(a[j]>a[j+1])
{
int tmp = a[j];
a[j] = a[j+1];
a[j+1] = tmp;
}
}
}
for(int i = 0;i<n;i++)
{
if(a[i]==x)
{
cout<<i+1;
}
}
return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a[10];
int n,m;
cin>>n>>m;
for(int i = 0;i<n;i++)
{
cin>>a[i];
}
for(int i = 0;i<n-1;i++)
{
for(int j = 0;j<=n-1-i;j++)
{
if(a[j]<a[j+1])
{
int tmp = a[i];
a[j] = a[j+1];
a[j+1] = tmp;
}
}
}
int cnt = 0;
for(int i = 0;i<n;i++)
{
cnt++;
m = m-a[i];
if(m<0)
{
cout<<cnt<<endl;
break;
}
}
cout<<"No";
return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
string a[10];
float b[10];
int n;
cin>>n;
for(int i = 0;i<n;i++)
{
cin>>a[i];
}
for(int i = 0;i<n-1;i++)
{
for(int j = 0;j<=n-1-i;j++)
{
if(a[j] == "female" && a[j+1] == "male")
{
string t1 = a[i];
a[j+1] = t1;
float t2 = b[j];
b[j] = b[j+1];
b[j+1] = t2;
}
else if(a[j] == "female" && a[j+1] == "female" && b[j]<b[j+1])
{
string t1 = a[i];
a[j+1] = t1;
float t2 = b[j];
b[j] = b[j+1];
b[j+1] = t2;
}
else if(a[j] == "male" && a[j+1] == "male" && b[j]>b[j+1])
{
string t1 = a[i];
a[j+1] = t1;
float t2 = b[j];
b[j] = b[j+1];
b[j+1] = t2;
}
}
}
for(int i=0;i<n;i++)
{
cout<<a[i]<<"/";
}
cout<<endl;
for(int i=0;i<n;i++)
{
cout<<b[i]<<"/";
}
return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int a[10];
string b[10];
int n;
cin>>n;
for(int i = 0;i<n;i++)
{
cin>>a[i];
}
for(int i = 0;i<n-1;i++)
{
for(int j = 0;j<=n-1-i;j++)
{
if(a[j]<=60 && a[j+1]>=60)
{
string t1 = a[i];
a[j+1] = t1;
float t2 = b[j];
b[j] = b[j+1];
b[j+1] = t2;
}
else if(a[j] >= 60 && a[j+1] >=60 && b[j]<b[j+1])
{
string t1 = a[i];
a[j+1] = t1;
float t2 = b[j];
b[j] = b[j+1];
b[j+1] = t2;
}
}
}
for(int i=0;i<n;i++)
{
cout<<a[i]<<"/t";
}
return 0;
}