HDOJ 2673 shǎ崽 OrOrOrOrz
生活随笔
收集整理的這篇文章主要介紹了
HDOJ 2673 shǎ崽 OrOrOrOrz
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
shǎ崽 OrOrOrOrz
此題是用來(lái)膜拜的
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int a[11111];
int b[11111];
int main()
{
? ? int n;
? ? while(cin>>n)
? ? {
? ? for(int i=0;i<n;i++)
? ? {
? ? ? ? cin>>a;
? ? }
? ? memset(b,0,sizeof(b));
? ? sort(a,a+n);
? ? int i=0;
? ? int j=n-1;
? ? int tot=0;
? ? while(i<=j)
? ? {
? ? ? ? if(b[j]!=1)
? ? ? ? {
? ? ? ? cout<<a[j];
? ? ? ? b[j]=1;j--;tot++;
? ? ? ? if(tot!=n) cout<<" ";
? ? ? ? }
? ? ? ? if(b!=1)
? ? ? ? {
? ? ? ? cout<<a;
? ? ? ? b=1;i++;tot++;
? ? ? ? if(tot!=n) cout<<" ";
? ? ? ? }
? ? }
? ? cout<<endl;
? ? }
? ? return 0;
}
?
轉(zhuǎn)載于:https://www.cnblogs.com/CKboss/archive/2013/05/06/3351070.html
總結(jié)
以上是生活随笔為你收集整理的HDOJ 2673 shǎ崽 OrOrOrOrz的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 关于简历的理解
- 下一篇: tcp协议与粘包现象【转http://w