题目地址:

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. Web前端开发--JS技术大梳理

    什么是JS      JavaScript是一种直译式脚本语言,是一种动态类型.弱类型.基于原型的语言,内置支持类型.它的解释器被称为JavaScript引擎,为浏览器的一部分,广泛用于客户端的脚本语 ...

  2. VueJS事件处理器v-on

    事件监听可以使用 v-on 指令. v-on:click表达式 HTML: <!DOCTYPE html> <html> <head> <meta chars ...

  3. Nginx 一些常用的URL 重写方法

    url重写应该不陌生,不管是SEO URL 伪静态的需要,还是在非常流行的wordpress里,重写无处不在. 1. 在 Apache 的写法 RewriteCond  %{HTTP_HOST}  n ...

  4. 【Wechall.net挑战】Anderson Application Auditing

    Wechall.net是一个国外用于练习CTF和攻防的网站,国内资料writeup不多,只有个别几篇.作为小白,近日玩了几道有意思的题目,在此分享 题目地址:http://www.wechall.ne ...

  5. Maven的安装以及在IDEA中的配置

    Maven的安装 之前的一篇博客中已经写到过了Maven的安装.这里就只给出链接了. http://www.cnblogs.com/tuhooo/p/5905569.html 版本虽然不同,但是安装的 ...

  6. 扒一扒P2P风控的底牌(转)

    互联网金融,这里面水就太深了,能当理财买的一般有两类,一个是货币基金,比如余额宝,这个大家已经十分清楚了,没什么风险, 但问题就是收益越来越低.实在是不过瘾了.而另外一种就是P2P理财了,收益很高,也 ...

  7. Java学习之路 第四篇 oop和class (面向对象和类)

    本人水平有限,创作本文是为了记录学习和帮助初学者学习,欢迎指正和补充 一.面向对象编程的设计概述 很多同学都在学校学了电脑的编程,现在的书籍大部分都是oop面向对象编程,一个很抽象的的名字,比较难以理 ...

  8. java 白皮书的关键术语

    [0]README 0.1) 本文转自 core java volume 1,仅供了解,所谓爱屋及乌嘛: 0.2) java的设计者编写了颇有影响力的白皮书,用来解释设计的初衷以及完成的情况,并发布了 ...

  9. 使用Reveal来查看别人的APP界面+白苹果不刷机解决方式

    Reveal这个强大的界面调试工具.能够实时查看.改动view的属性,大体上实现了iOS程序猿梦寐以求的功能.比方,有时候我们加入了一个view,可是那个view死活不显示出来,这时候祭出Reveal ...

  10. java项目中的classpath到底是什么

    https://segmentfault.com/a/1190000015802324