再水一发,舍友肿么还在睡T T。

---------------------------------舍友还在睡觉的分割线---------------------------------

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3200

大意:给你一串字符串,要求你按'Z''O''J''7'+‘其他字符’排好序。

代码不太美观。不过还好啦。

不要像题目说的那样傻傻的排序,直接数个数就可以啦。输出的时候不是那四个字母就输出~

#include<cstdio>
#include<cstring>
const int MAXN=1000;
char str[MAXN];
int num[5];
int main()
{
char temp;
while(~scanf("%s",str))
{
int len=strlen(str); for(int i=0;i<5;i++)
num[i]=0; for(int i=0;i<len;i++)
{
if(str[i]=='Z')
num[0]++;
else if(str[i]=='O')
num[1]++;
else if(str[i]=='J')
num[2]++;
else if(str[i]=='7')
num[3]++;
} for(int i=0;i<num[0];i++)
printf("Z");
for(int i=0;i<num[1];i++)
printf("O");
for(int i=0;i<num[2];i++)
printf("J");
for(int i=0;i<num[3];i++)
printf("7");
for(int i=0;i<len;i++)
{
if(str[i]!='Z' && str[i]!='O' && str[i]!='J' && str[i]!='7')
printf("%c",str[i]);
}
printf("\n"); } return 0;
}

ZOJ 3168 Sort ZOJ7 水的更多相关文章

  1. ZOJ 2723 Semi-Prime ||ZOJ 2060 Fibonacci Again 水水水!

    两题水题: 1.如果一个数能被分解为两个素数的乘积,则称为Semi-Prime,给你一个数,让你判断是不是Semi-Prime数. 2.定义F(0) = 7, F(1) = 11, F(n) = F( ...

  2. ZOJ 3827 Information Entropy 水

    水 Information Entropy Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge Informati ...

  3. ZOJ 3787 Access System 水

    LINK:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3787 思路:结构体 时间转化为秒记录下最小并且排序就好了 /** ...

  4. ZOJ 3819 Average Score 水

    水 Average Score Time Limit: 2 Seconds      Memory Limit: 65536 KB Bob is a freshman in Marjar Univer ...

  5. ZOJ List the Books 水~

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1727 题目大意: 给你书名.出版时间.价格,让你按照一定的顺序排序.. 其中题 ...

  6. ZOJ Special AC String 水

    http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3702 题目大意: 对于给定的一个字符串,满足如下要求输出AC,否则WA(好吧我 ...

  7. ZOJ 2514 Generate Passwords 水

    啦啦啦,水一发准备去复习功课~ ------------------------------------------水一发的分割线----------------------------------- ...

  8. ZOJ 3827 Information Entropy 水题

    Information Entropy Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.zju.edu.cn/onlinejudge/sh ...

  9. ZOJ 3846 GCD Reduce//水啊水啊水啊水

    GCD Reduce Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge You are given a sequ ...

随机推荐

  1. sim800c GPRS模块的透传模式

    一.透传模式 基于sim800c GPRS模块在建立TCP/IP连接情况下,可以设置进入透传模式,用来接收和发送数据,一旦进入即从串口收到的数据将被打包,然后发送.接收同理. 注意在透传模式下所有的A ...

  2. 【Uva 12093】Protecting Zonk

    [Link]: [Description] n个节点的树; 每个节点都可以选择3种 1.覆盖和它相连的边; c1花费; 2.覆盖和它相连的边以及和它相连的点相连的边; c2花费; 3.不进行操作 覆盖 ...

  3. 堆-heap

    #include <vector> #include <cstdio> using namespace std; class Heap { private : vector&l ...

  4. layoutParams-动态更改某个控件的margin

    其实它的方法也非常的简单,如下 LinearLayout.LayoutParams layoutParams = (LayoutParams) bt1.getLayoutParams(); int a ...

  5. 6lession-基本数据类型

    因为自己是根据网上教程学习的,所以以下内容参考自 http://www.w3cschool.cc/python/python-variable-types.html python支持物种数据类型,分别 ...

  6. 关于mybatis里面的Executor--转载

    原文地址:http://blog.csdn.net/w_intercool/article/details/7893344 使用mybatis查寻数据,跟踪其执行流程 最开始执行的语句 this.ge ...

  7. Android 安卓直播开源: RTMP 推流SDK

    前些日子在github上提交了基于GPUImage的iOS直播推流SDK(https://github.com/runner365/GPUImageRtmpPush) 最近整理了Android直播推流 ...

  8. go pointer

    go pointer package main import "fmt" type Mutatable struct { a int b int } func (m Mutatab ...

  9. CList 点击表头排序 (1)SortItems函数

    点击表头排序整体的思路都是去 CListCtrl类中的方法SortItems去实现 CListCtrl::SortItems的原型是: BOOL SortItems( PFNLVCOMPARE pfn ...

  10. 【2017 Multi-University Training Contest - Team 9】FFF at Valentine

    [链接]http://acm.hdu.edu.cn/showproblem.php?pid=6165 [题意] 一张有向图,n个点,m条边,保证没有重边和自环.询问任意两个点能否满足任何一方能够到达另 ...