题目地址:

http://acm.hdu.edu.cn/showproblem.php?pid=2673

拍两次序,交替输出


 #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
#define MAX_NUMBER 10000
bool myfunction1 (int i,int j) { return (i<j); }
bool myfunction2 (int i,int j) { return (i>j); }
int number[][MAX_NUMBER];
int main()
{
//freopen("input.txt","r",stdin);
int n,tmp,count=,index,flag;
while(cin>>n && n!=)
{
for(int i=;i<n;i++)
{
cin>>tmp;
number[][i]=number[][i]=tmp;
}
sort(number[],number[]+n,myfunction1);
sort(number[],number[]+n,myfunction2);
index=count=;
flag=;
while(index<n && count<n)
{
if(flag) cout<<" ";
if(count<n) {cout<<number[][index];count++;}
if(count<n) {cout<<" "<<number[][index];index++;count++;}
flag=;
}
}
return ;
}

[acm]HDOJ 2673 shǎ崽 OrOrOrOrz的更多相关文章

  1. HDU 2673 shǎ崽 OrOrOrOrz

    #include <cstdio> #include <algorithm> using namespace std; int main() { int n; while (s ...

  2. HDU2673:shǎ崽 OrOrOrOrz

    Problem Description Acmer in HDU-ACM team are ambitious, especially shǎ崽, he can spend time in Inter ...

  3. hdu 1.3.4 shǎ崽 OrOrOrOrz

    简单的排序,注意输出即可 #include <iostream> #include <algorithm> using namespace std; int main() { ...

  4. hdu 2671 shǎ崽 OrOrOrOrz(排序)

    题意:排序后按题目要求输出 思路:排序 #include<iostream> #include<stdio.h> #include<algorithm> using ...

  5. [acm]HDOJ 2059 龟兔赛跑

    题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=2059 起点和终点,共n+2个点,n+2个状态,简单DP即可. //11512698 2014-08- ...

  6. [acm]HDOJ 1200 To and Fro

    题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=1200 简单字符串处理,找规律 /* 11509672 2014-08-21 11:32:55 Acc ...

  7. [acm]HDOJ 2064 汉诺塔III

    题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=2064 汉诺塔变种,只能从中间专业,递归关系为:f(n)=3*f(n-1)+2. //汉诺塔变种,只能 ...

  8. [acm]HDOJ 3082 Simplify The Circuit

    题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=3082 字符串处理+并联电阻公式 //11481261 2014-08-18 16:52:47 Acc ...

  9. hdu-2673-shǎ崽 OrOrOrOrz(水题)

    注意输出格式 #include <iostream> #include <algorithm> using namespace std; +]; int main() { in ...

随机推荐

  1. linux配置nfs步骤及心得

      这节我们介绍NFS的相关概念,以及怎样配置NFS和在client中查看NFS.   NFS的配置过程非常easy. 在server端中编辑/etc/exports文件,加入例如以下内容:      ...

  2. android开发系列之视频断点续传

    今天在这篇博客里面,我想说说自己在这几天遇到的一个棘手的问题,就是视频断点续传的问题.其实这在我们开发中是一个很常见的应用场景,比如视频.音频.pdf等相关的文档.如果之前没有接触过的话,你也许会被这 ...

  3. dede列表页调用文章,其实是所有页面都可以调用,第一次应用sql标签

    {dede:sql sql="SELECT aid,typeid,body,userip FROM `#@__addonarticle` where aid='6' or aid='7' o ...

  4. android之Context对各种服务的管理

    经常,当我们须要用到服务的时候能够通果Context来获取:Context.getSystemService(name):比方:当我们想知道当前电话状态(来电/去电/sim卡状态等)时候,我们能够通过 ...

  5. Oracle:复合触发器

    ----- CF_DEPTUCORGANIZATION  INSERT UPDATE DELETE 触发器CREATE  OR REPLACE TRIGGER tr_del_CF_DEPTUCORGA ...

  6. 基于UML的需求分析和系统设计个人体会

    阅读了http://www.uml.org.cn/oobject/201405123.asp文章之后,对使用UML进行系统的需求分析和设计有了一个基础的理解.在此做一下整理.   1.项目开始阶段 项 ...

  7. go web的简单服务器

    1)简单web服务器: package main import ( "fmt" "net/http" ) func sayHelloName(w http.Re ...

  8. XMPP协议概述

    XMPP(Extensible Messaging and Presence Protocol,前称Jabber)是一种以 XML 为基础的开放式实时通信协议,关于它的协议细节,网上已经有太多分析文章 ...

  9. 循序渐进学Python 1 安装与入门

    1 安装 2 使用 2.1 运行程序 3 艺搜参考 by 2013年10月16日 安装 Windows安装版,源码,帮助文档: 使用 打开开始菜单中的Python GUI启动Python解释器: 启动 ...

  10. Portal实现原理

    https://blog.csdn.net/sukyle/article/details/6456930