ZOJ 3168 Sort ZOJ7 水
再水一发,舍友肿么还在睡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 水的更多相关文章
- ZOJ 2723 Semi-Prime ||ZOJ 2060 Fibonacci Again 水水水!
两题水题: 1.如果一个数能被分解为两个素数的乘积,则称为Semi-Prime,给你一个数,让你判断是不是Semi-Prime数. 2.定义F(0) = 7, F(1) = 11, F(n) = F( ...
- ZOJ 3827 Information Entropy 水
水 Information Entropy Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Informati ...
- ZOJ 3787 Access System 水
LINK:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3787 思路:结构体 时间转化为秒记录下最小并且排序就好了 /** ...
- ZOJ 3819 Average Score 水
水 Average Score Time Limit: 2 Seconds Memory Limit: 65536 KB Bob is a freshman in Marjar Univer ...
- ZOJ List the Books 水~
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1727 题目大意: 给你书名.出版时间.价格,让你按照一定的顺序排序.. 其中题 ...
- ZOJ Special AC String 水
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=3702 题目大意: 对于给定的一个字符串,满足如下要求输出AC,否则WA(好吧我 ...
- ZOJ 2514 Generate Passwords 水
啦啦啦,水一发准备去复习功课~ ------------------------------------------水一发的分割线----------------------------------- ...
- ZOJ 3827 Information Entropy 水题
Information Entropy Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.zju.edu.cn/onlinejudge/sh ...
- ZOJ 3846 GCD Reduce//水啊水啊水啊水
GCD Reduce Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge You are given a sequ ...
随机推荐
- SNMP介绍,OID及MIB库
http://blog.sina.com.cn/s/blog_4502d59c0101fcy2.html
- C语言编程入门——程序练习(下)
C语言的一些简单操作练习. 互换两个数字: # include <stdio.h> int main(void) { int i = 3; int j = 5; int t; //将i ...
- CodeForce 424C Magic Formulas
这个题就是求出给的公式的结果. 仅仅要知道异或运算满足交换律跟结合律即可了.之后就是化简公式. #include<map> #include<string> #include& ...
- android notify
notify http://examples.javacodegeeks.com/android/core/ui/notifications/android-notifications-example ...
- Large Division (大数求余)
Given two integers, a and b, you should check whether a is divisible by b or not. We know that an in ...
- POJ 1320 Street Numbers Pell方程
http://poj.org/problem?id=1320 题意很简单,有序列 1,2,3...(a-1),a,(a+1)...b 要使以a为分界的 前缀和 和 后缀和 相等 求a,b 因为序列很 ...
- CISP/CISA 每日一题 16
CISA 每日一题(答) 作业调度软件的优点: 1.作业信息仅需建立一次,减少错误发生概率: 2.可定义作业间的依赖关系,当某一项作业失败时,依赖于该作业的后续作业就不会被执行: 3.所有成功或失败的 ...
- 82.管道实现cgi内存多线程查询
总体思路就是客户端写入要查询的数据到管道中,服务器端从管道读取,然后写入随机文件,再把文件名写入管道,然后客户端再读取文件 服务器端 设置缓冲区大写,设置管道名字,以及标识有多少个线程等 //设置缓存 ...
- hibernate hbm.xml配置映射
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...
- Android开发系列(二十):AutoCompleteTextView(自己主动完毕文本框)的功能和使用方法
当用户输入一定的字符之后,自己主动完毕文本框可以显示一个下拉菜单,供用户从中选择,当用户选择某个菜单项之后,AutoCompleteTextView可以依照用户的选择自己主动填写该文本框 AutoCo ...