题目链接:http://ac.jobdu.com/problem.php?pid=1006

详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus

参考代码:

//
// 1006 ZOJ问题.cpp
// Jobdu
//
// Created by PengFei_Zheng on 28/04/2017.
// Copyright © 2017 PengFei_Zheng. All rights reserved.
// #include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <cmath>
#define MAX_SIZE 1001 using namespace std; string str; bool judge(){
int idxZ = - ;
int idxJ = - ;
bool zoj = true;
int len = (int)str.size();
for(int i = ; i < len ; i++){
if(str[i]=='z' && idxZ == -){
idxZ = i;
}
else if(str[i]=='j' && idxJ == -){
idxJ = i;
}
else if(str[i]!='o'){
zoj = false;
}
}
int a = idxZ;
int b = idxJ - idxZ -;
int c = len - - idxJ;
if(zoj && idxZ != - && idxJ != - && (idxZ + < idxJ) && a*b==c){
return true;
}
else return false;
}
int main(){
while(cin>>str){
if(judge()){
printf("Accepted\n");
}
else{
printf("Wrong Answer\n");
}
}
}
/**************************************************************
Problem: 1006
User: zpfbuaa
Language: C++
Result: Accepted
Time:60 ms
Memory:1520 kb
****************************************************************/

最新文章

  1. WiX Toolset 教程索引页
  2. MVC中RenderBody的工作原理
  3. ajax+div 代替iframe 学习尝试
  4. Error: Bootstrap&#39;s JavaScript requires jQuery错误
  5. Anliven - 有效阅读的方法
  6. Ruby中 使用Builder Xml Markup 操作XML
  7. Nginx + PHP 缓存详解
  8. Context Menu on DataGrid
  9. LeetCode 3
  10. JavaScript/jQuery选择器简介
  11. bootstrap_下拉菜单+头部
  12. Spring-MVC请求参数值和向页面传值
  13. markdown箭头的处理
  14. java获取真实的IP地址工具类
  15. ASP MD5
  16. SpringSecurity实现图形验证码功能
  17. Qt5 中文乱码问题
  18. Hadoop基础-Hdfs各个组件的运行原理介绍
  19. zabbix3.0.4 配置邮件报警
  20. 9-centos定时任务-不起作用- 没指明路径!!!

热门文章

  1. Fedora26 tftp-server设置
  2. [iOS]XCODE5升级之路
  3. linux nginx,php开机启动
  4. datatable编辑一行数据的方法
  5. IT规划,是否一定要梳理流程
  6. mongo文件空间
  7. 理解firewall
  8. 自动构建工具Gulp
  9. Activiti 5.1.4最佳实践
  10. spring学习之springMVC 返回类型选择 以及 SpringMVC中model,modelMap.request,session取值顺序