读入一个字符串,字符串中包含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. CSS 伪类与伪元素

    CSS的元素选择器除了根据id(#).class(.).属性([ ])选取元素以外,还有很重要的一类,就是根据元素的特殊状态来选取元素.它们就是伪类和伪元素.跟id选择器.类选择器.属性选择器以及派生 ...

  2. Tensorflow学习(练习)—使用inception做图像识别

    import osimport tensorflow as tfimport numpy as npimport re from PIL import Imageimport matplotlib.p ...

  3. 在Sqlserver中使用Try Catch

      创建错误日志表: CREATE TABLE ErrorLog(errNum INT,ErrSev NVARCHAR(1000),ErrState INT,ErrProc NVARCHAR(1000 ...

  4. ubunt 14.04 Could not find CMAKE_ROOT !!! CMake has most likely not been installed correctly. Modul

    CMake Error: Could not find CMAKE_ROOT !!! CMake has most likely not been installed correctly. Modul ...

  5. jquery中children()

  6. 学习Vue.js需要了解的部分内容

    重要: 1.如果要通过js/模板引用 图片到项目,图片路径需要使用require. 2.$event: $event 等于$emit 抛出的值,还可以使用$event.target.value. $e ...

  7. 基于django rest framework做认证组件

    先导入要用到的类 from rest_framework.authentication import BaseAuthentication from rest_framework.exceptions ...

  8. dev 官网

    https://www.devexpress.com/Support/Center/Example/Details/E1343 <%@ Page Language="C#" ...

  9. Linux下面rpm命令和mount命令详解

    在Linux下面我们经常会安装一些软件包,还有挂载命令.接下来,我们通过一些实例来演示这些命令的使用.. 第一步:我们先在linux下面挂载光盘,先进入到根目录,然后切换到根下面的/mnt目录,因为/ ...

  10. Unity破解不成功解决方案

    你是不是遇到过Unity新版本出来的时候就急着使用,但是安装好了,却破解不成功的问题(你之前的版本破解过).这是由于你的注册表没有彻底的删除,接下来我们图解如何清理. 1.卸载以前的版本,卸载完了删除 ...