1040 As Easy As A+B
来源:互联网 发布:mysql的having max函数 编辑:程序博客网 时间:2024/05/17 07:06
#include<iostream>
#include<vector>
using namespace std;
void sort(vector<int>&v);
void sort(vector<int>&v)
{
int n=v.size();
for(int next=1;next<n;next++)
{
int temp=v[next];
for(int j=next-1;j>=0&&temp<v[j];j--)
{
v[j+1]=v[j];
}
v[j+1]=temp;
}
}
int main()
{
for(int T;cin>>T;)
{
for(int N;T--&&cin>>N;)
{
vector<int>v(N);
for(int i=0;i<N;i++)
{
cin>>v[i];
}
sort(v);
for(int j=0;j<N-1;j++)
{
cout<<v[j]<<" ";
}
cout<<v[N-1];
cout<<endl;
}
}
return 0;
}
#include<vector>
using namespace std;
void sort(vector<int>&v);
void sort(vector<int>&v)
{
int n=v.size();
for(int next=1;next<n;next++)
{
int temp=v[next];
for(int j=next-1;j>=0&&temp<v[j];j--)
{
v[j+1]=v[j];
}
v[j+1]=temp;
}
}
int main()
{
for(int T;cin>>T;)
{
for(int N;T--&&cin>>N;)
{
vector<int>v(N);
for(int i=0;i<N;i++)
{
cin>>v[i];
}
sort(v);
for(int j=0;j<N-1;j++)
{
cout<<v[j]<<" ";
}
cout<<v[N-1];
cout<<endl;
}
}
return 0;
}
- 1040 As Easy As A+B
- hoj 1040 As Easy As A+B
- HDU-1040 as easy as a+b
- 1040 As Easy As A+B
- hdu 1040 As Easy As A+B
- hdu 1040 As Easy As A+B
- hdu 1040 As Easy As A+B
- hdu 1040 As Easy As A+B
- hdu 1040 As Easy As A+B
- Hdu 1040 - As Easy As A+B
- As Easy As A+B 1040
- HDU 1040 As Easy As A+B
- As Easy As A+B 1040
- HDOJ 1040 As Easy As A+B
- hdu-1040-As Easy As A+B
- As Easy As A+B hdu 1040
- HDOJ 1040 As Easy As A+B
- HDU--1040 As Easy As A+B
- 1022 Train Problem I
- 2008 October 13th Monday (十月 十三日 月曜日)
- 1028 Ignatius and the Princess III
- 2008 October 14th Tuesday (十月 十四日 火曜日)
- 2008 October 15th Wednesday (十月 十五日 水曜日)
- 1040 As Easy As A+B
- 2008 October 16th Thursday (十月 十六日 木曜日)
- 1049 Climbing Worm
- 1050 Moving Tables
- 2008 October 17th Friday (十月 十七日 金曜日)
- 严重: IOException while loading persisted sessions: java.io.EOFException
- 1061 Rightmost Digit
- 1071 The area
- 1085 Holding Bin-Laden Captive!