[acm]HDOJ 2673 shǎ崽 OrOrOrOrz
题目地址:
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的更多相关文章
- HDU 2673 shǎ崽 OrOrOrOrz
#include <cstdio> #include <algorithm> using namespace std; int main() { int n; while (s ...
- HDU2673:shǎ崽 OrOrOrOrz
Problem Description Acmer in HDU-ACM team are ambitious, especially shǎ崽, he can spend time in Inter ...
- hdu 1.3.4 shǎ崽 OrOrOrOrz
简单的排序,注意输出即可 #include <iostream> #include <algorithm> using namespace std; int main() { ...
- hdu 2671 shǎ崽 OrOrOrOrz(排序)
题意:排序后按题目要求输出 思路:排序 #include<iostream> #include<stdio.h> #include<algorithm> using ...
- [acm]HDOJ 2059 龟兔赛跑
题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=2059 起点和终点,共n+2个点,n+2个状态,简单DP即可. //11512698 2014-08- ...
- [acm]HDOJ 1200 To and Fro
题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=1200 简单字符串处理,找规律 /* 11509672 2014-08-21 11:32:55 Acc ...
- [acm]HDOJ 2064 汉诺塔III
题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=2064 汉诺塔变种,只能从中间专业,递归关系为:f(n)=3*f(n-1)+2. //汉诺塔变种,只能 ...
- [acm]HDOJ 3082 Simplify The Circuit
题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=3082 字符串处理+并联电阻公式 //11481261 2014-08-18 16:52:47 Acc ...
- hdu-2673-shǎ崽 OrOrOrOrz(水题)
注意输出格式 #include <iostream> #include <algorithm> using namespace std; +]; int main() { in ...
随机推荐
- hint指定index的深入理解
http://czmmiao.iteye.com/blog/1480247创建一个表,含有位图index和b-tree index SQL> create table t as select o ...
- swiper的理解
参考:Swiper中文网 Swiper使用方法: <!DOCTYPE html> <html> <head> <meta charset="UTF- ...
- cocos2d-x-lua基础系列教程五(lua单例)
lua-单例 function newAccount(initlizedBanlance) local self = {balance = initlizedBanlance} local show ...
- 基于jenkins,tekton等工具打造kubernetes devops平台
本贴为目录贴,将不断更新 目录 1.Docker在centos下安装以及常见错误解决 2.使用kubernetes 官网工具kubeadm部署kubernetes(使用阿里云镜像) 3.无法访问gcr ...
- mysql 相关博客地址
MySQL概念学习与逐步上手操作系列(一套完整) https://www.cnblogs.com/zlslch/category/962962.html
- Makefile浅尝
[0]README makefile定义: 一个工程中的源文件不计其数,其按类型.功能.模块分别放在若干个目录中,makefile定义了一系列的规则来指定,哪些文件需要一先编译,哪些文件需要后编译,哪 ...
- PHP进阶知识
关于PHP程序员技术职业生涯规划:http://rango.swoole.com/ Micro Service Framework For PHP:https://github.com/pinguo/ ...
- fzu 2039 Pets (简单二分图 + (最大流 || 二分图))
Are you interested in pets? There is a very famous pets shop in the center of the ACM city. There ar ...
- 关于EF输出sql的执行日志
sqlserver中可以使用sql profiler:但是mysql当中无法查看:只能借助于组件: ADO.NET Entity Framework CodeFirst 如何输出日志(EF4.3) 用 ...
- C# 自定义控件制作和使用实例(winform)(转)
本例是制作一个简单的自定义控件,然后用一个简单的测试程序,对于初学者来说,本例子比较简单,只能起到抛石引玉的效果. 我也是在学习当中,今后会将自己所学的逐步写出来和大家交流共享. 第一步:新建一个 ...