再水一发,舍友肿么还在睡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. 【Uva 10641】 Barisal Stadium

    [Link]: [Description] 输入一个凸n(3≤n≤30)边形体育馆和多边形外的m(1≤m≤1000)个点光源,每个点光 源都有一个费用值.选择一组点光源,照亮整个多边形,使得费用值总和 ...

  2. [Anuglar & NgRx] StoreRouterConnectingModule

    Always treat Router as the source of truth When we use Ngrx, we can see that we will use a "Sto ...

  3. unity3d编程日志

    2014/4/27 编写脚本的时候,加入了中文凝视,发现console面板有非常多不可思议的bug.查了一下发现是由于monodevelop脚本中文凝视报错,而英文凝视不会受影响. 解决方法:把凝视放 ...

  4. start_kernel----lcokdep_init

    void lockdep_init(void) { int i; /* * Some architectures have their own start_kernel() * code which ...

  5. 漫话C++之string字符串类的使用(有汇编分析)

    C++中并不提倡继续使用C风格的字符串,而是为字符串定义了专门的类,名为string. 使用前的准备工作 在使用string类型时,需要包含string头文件,且string位于std命名空间内: # ...

  6. 任务调度(四)——ScheduledExecutorService替代Timer,实现多线程任务调度

    上篇博文<任务调度(三)--Timer的替代品ScheduledExecutorService简介>已经对ScheduledExecutorService做了简介.事实上使用Schedul ...

  7. 11.使用 package.json

    转自:http://www.runoob.com/nodejs/nodejs-express-framework.html package.json 位于模块的目录下,用于定义包的属性.接下来让我们来 ...

  8. go 语言学习笔记 0001 --> iota

    go语言中预置了一个预定义常量 iota 这个东西有个很奇怪的特性,会根据 const 关键字改变值 默认的,iota在const出现的时候会初始化为0,而后不断递加1,直到出现第二个const关键字 ...

  9. 设计模式六大原则(二):里氏替换原则(Liskov Substitution Principle)

    里氏替换原则(LSP)由来: 最早是在 妖久八八 年, 由麻神理工学院得一个女士所提出来的. 定义: 1:如果对每一个类型为 T1的对象 o1,都有类型为 T2 的对象o2,使得以 T1定义的所有程序 ...

  10. android adb常见问题的解决方法!

    ** adb的常见问题     adb:android debug bridge,用于连接模拟器/手机与PC端软件(比如:eclipse或者xx手机助手)     adb devices -> ...