读入一个字符串,字符串中包含ZOJ三个字符,个数不一定相等,按ZOJ的顺序输出,当某个字符用完时,剩下的仍然按照ZOJ的顺序输出。

MY:(OUTPUT LIMIT EXCEED)

 #include<cstdio>
#include<iostream>
#include<cstring>
#include<ctime>
#include<algorithm>
#include<cmath>
//#include<stack>
#define R(a,b,c) for(register int (a)=(b);(a)<=(c);++(a))
#define nR(a,b,c) for(register int (a)=(b);(a)>=(c);--(a))
#define Ii inline int
#define Il inline long long
#define Iv inline void
#define Id inline double
#define Ib inline bool
#define ll long long
#define re register
#define Fill(a,b) memset((a),(b),sizeof((a)))
#define Cmax(a,b) ((a)=(a)>(b)?(a):(b))
#define Cmin(a,b) ((a)=(a)<(b)?(a):(b))
#define D_e(x) printf("&_____%d______&",x);
#define D_e_Line printf("\n-----------------\n");
#define Pause system("pause")
using namespace std;
//const int N=100001;
//const int M=500001;
Ii read(){
int s=,f=;char c;
for(c=getchar();c<''||c>'';c=getchar())if(c=='-')f=-;
while(c>=''&&c<='')s=s*+(c^''),c=getchar();
return s*f;
}
Iv print(int x){
if(x<)putchar('-'),x=-x;
if(x>)print(x/);
putchar(x%^'');
}
int main(){
string s;
while(){
getline(cin,s);
if(s=="E")return ;
int P_o=s.find('O'),P_j=s.find('J'),
c1=P_o,c2=P_j-P_o,c3=s.length()-P_j;
while(){
int flag=;
if(c1)--c1,putchar('Z'),flag=;
if(c2)--c2,putchar('O'),flag=;
if(c3)--c3,putchar('J'),flag=;
if(flag==)break;
}
cout<<endl;
}
}

My.cpp

STD:

 #include<cstdio>
#include<iostream>
#include<cstring>
#include<ctime>
#include<algorithm>
#include<cmath>
//#include<stack>
#define R(a,b,c) for(register int (a)=(b);(a)<=(c);++(a))
#define nR(a,b,c) for(register int (a)=(b);(a)>=(c);--(a))
#define Ii inline int
#define Il inline long long
#define Iv inline void
#define Id inline double
#define Ib inline bool
#define ll long long
#define re register
#define Fill(a,b) memset((a),(b),sizeof((a)))
#define Cmax(a,b) ((a)=(a)>(b)?(a):(b))
#define Cmin(a,b) ((a)=(a)<(b)?(a):(b))
#define D_e(x) printf("&_____%d______&",x);
#define D_e_Line printf("\n-----------------\n");
#define Pause system("pause")
using namespace std;
//const int N=100001;
//const int M=500001;
Ii read(){
int s=,f=;char c;
for(c=getchar();c<''||c>'';c=getchar())if(c=='-')f=-;
while(c>=''&&c<='')s=s*+(c^''),c=getchar();
return s*f;
}
Iv print(int x){
if(x<)putchar('-'),x=-x;
if(x>)print(x/);
putchar(x%^'');
}
int main(){
char s[];
while(scanf("%s",s)!=EOF){
int c1=,c2=,c3=;
if(strcmp(s,"E")==)break;
int len=strlen(s);
R(i,,len-)
c1+=(s[i]=='Z'),
c2+=(s[i]=='O'),
c3+=(s[i]=='J');
while(){
int flag=;
if(c1>)--c1,putchar('Z'),flag=;
if(c2>)--c2,putchar('O'),flag=;
if(c3>)--c3,putchar('J'),flag=;
if(flag==)break;
//D_e(c1);
//D_e_Line;
}
cout<<endl;
}
}
/*
ZOJZOJZOZOZOOOO
ZOJZOJZOZOZOOOO
*/

STD.cpp

RAND:

 #include<bits/stdc++.h>
using namespace std;
#define random(a,b) ((a)+rand()%((b)-(a)+1)) stringstream ss; int main( int argc, char *argv[] )
{
int seed=time(NULL);
if(argc)
{
ss.clear();
ss<<argv[];
ss>>seed;
}
srand(seed);
int T=rand()%+;
while(T--){
int num_z=rand()%+,
num_o=rand()%+,
num_j=rand()%+;
while(num_z--)putchar('Z');
while(num_o--)putchar('O');
while(num_j--)putchar('J');
putchar('\n');
}
putchar('E');
return ;
}

RAND.cpp

HDU 3783的更多相关文章

  1. HDU 3783 ZOJ

    ZOJ Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...

  2. hdu 1598 find the most comfortable road (并查集+枚举)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1598 find the most comfortable road Time Limit: 1000/ ...

  3. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  4. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

  5. hdu 4859 海岸线 Bestcoder Round 1

    http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...

  6. HDU 4569 Special equations(取模)

    Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  7. HDU 4006The kth great number(K大数 +小顶堆)

    The kth great number Time Limit:1000MS     Memory Limit:65768KB     64bit IO Format:%I64d & %I64 ...

  8. HDU 1796How many integers can you find(容斥原理)

    How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d ...

  9. hdu 4481 Time travel(高斯求期望)(转)

    (转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...

随机推荐

  1. Codeforces 1153D 树形DP

    题意:有一个游戏,规则如下:每个点有一个标号,为max或min, max是指这个点的值是所有子节点中值最大的那一个,min同理.问如何给这颗树的叶子节点赋值,可以让这棵树的根节点值最大. 思路:很明显 ...

  2. linux的deamon后台运行

    有的时候需要将程序一直跑在后台,比如一些服务类代码,或者一些监控类代码.使用deamon是正确的一种思路. 以前我们在看<unix环境高级编程>的时候,有专门的整章详细介绍如何编写一个后台 ...

  3. ubuntu 安装两个版本的Anaconda

    1.下载anaconda2/anaconda3,下载地址:https://www.anaconda.com/download/#linux,anaconda官网如下所示,选择对应版本下载. 2.使用如 ...

  4. Use SFTP in Linux (转)

    From http://www.cnblogs.com/chen1987lei/archive/2010/11/26/1888391.html sftp 是一个交互式文件传输程式.它类似于 ftp, ...

  5. Spring下面的@Transactional注解标志的讲解

    最近在开发中对Spring中的事务标记@Transactional用的比较多,今天上网收集了一些内容,做一个简单的总结~~~ 在service类前加上@Transactional,声明这个servic ...

  6. SpringMVC——数据转换 & 数据格式化 & 数据校验

    一.数据绑定流程 1. Spring MVC 主框架将 ServletRequest 对象及目标方 法的入参实例传递给 WebDataBinderFactory 实例,以创 建 DataBinder ...

  7. maven构建非法字符解决办法

    CI使用maven做版本构建时候碰到了一个问题,有个java源码始终编译报错,错误发生在文件第一行. 出错内容是: ***.java:[1,1] 非法字符: \65279 后面上网看了,原来是文件编码 ...

  8. 编写高质量代码改善C#程序的157个建议——建议43:让接口中的泛型参数支持协变

    建议43:让接口中的泛型参数支持协变 除了上一建议中提到的使用泛型参数兼容接口不可变性外,还有一种办法是为接口中的泛型声明加上out关键字来支持协变,如下所示: interface ISalary&l ...

  9. Spring MVC:Model、View、ModelAndView

    个人理解:View为服务器上的某个文件容器,可以为JSP,FTL等动态页面文件,甚至是媒体文件等等,单单是一个文件.Model的作用是存储动态页面属性,动态页面文件即View可以在Model中获取动态 ...

  10. EBS登陆界面个性化

    把完整资料贴出来 Set the profile option Local Login Mask (FND_SSO_LOCAL_LOGIN_MASK). (This profile option is ...