读入一个字符串,字符串中包含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. python学习路线以及视频下载

    作者:林其链接:https://www.zhihu.com/question/19660572/answer/194904019来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明 ...

  2. 面试题:HashMap和ConcurrentHashMap的区别,HashMap的底层源码。

    Hashmap本质是数组加链表.根据key取得hash值,然后计算出数组下标,如果多个key对应到同一个下标,就用链表串起来,新插入的在前面. ConcurrentHashMap:在hashMap的基 ...

  3. Linux设置串口波特率等参数

    转自 http://blog.csdn.net/zoomdy/article/details/50921336 mingdu.zheng at gmail dot com stty查看串口参数 stt ...

  4. 使用原理视角看 Git

    1. Git 的玩法 欢迎来到 Coding 技术小馆,我叫谭贺贺,目前我在 Coding.net 主要负责 WebIDE 与 Codeinsight 的开发.我今天带来的主要内容是 Git 的原理与 ...

  5. 基于.Net平台常用的组件和框架整理

    转载自:http://www.cnblogs.com/hgmyz/p/5313983.html 基于转载进行补充 RPC框架: RPC:远程过程调用协议,它是一种通过网络从远程计算机程序上请求服务,而 ...

  6. vb.net 中 listview 中编辑 可以用 ComboBox 选择编辑数据

    Public Class ModifyLineData Dim mousePos As Point Dim pubListviewitem As ListViewItem Dim imgList As ...

  7. TSQL--时间类型和毫秒数转换

    项目中使用BIGINT来存放时间,以下代码用来转换时间类型和BIGINT类型 SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ========= ...

  8. delegate Func Action Expression

    using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; na ...

  9. SSM项目配置文件及其各项使用

    $说明: ·Spring 5  + Mybatis 3.4.5 +SpringMVC  ·使用druid数据库 ·使用log4j输出日志 $Spring 及其配置文件(部分) Spring官方网站:h ...

  10. C++ TIM或者QQ 自动发送消息

    简单写了一下 很简单的demo 闲着没事干 #include "stdafx.h" #include <thread> #include <Windows.h&g ...