转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud

Strange Class

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)

Problem Description
In Vivid’s school, there is a strange class(SC). In SC, the students’ names are very strange. They are in the same format: anbncn(a,b,c must not be the same with each other). For example studens whose names are“abc”,”ddppqq” are in SC, however studens whose names are “aaa”,“ab”,”ddppqqq” are not in SC.
Vivid makes friends with so many students, he wants to know who are in SC.
 
Input
There are multiple test cases (about 10), each case will give a string S which is the name of Vivid’s friend in a single line.
Please process to the end of file.

[Technical Specification]

1≤|S|≤10.

|S| indicates the length of S.

S only contains lowercase letter.

 
Output
For each case, output YES if Vivid’s friend is the student of SC, otherwise output NO.
 
Sample Input
abc
bc
 
Sample Output
YES
NO

必须是连续的字母。。。被坑了

 //#####################
//Author:fraud
//Blog: http://www.cnblogs.com/fraud/
//#####################
#include <iostream>
#include <sstream>
#include <ios>
#include <iomanip>
#include <functional>
#include <algorithm>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cctype>
using namespace std;
#define XINF INT_MAX
#define INF 0x3FFFFFFF
#define MP(X,Y) make_pair(X,Y)
#define PB(X) push_back(X)
#define REP(X,N) for(int X=0;X<N;X++)
#define REP2(X,L,R) for(int X=L;X<=R;X++)
#define DEP(X,R,L) for(int X=R;X>=L;X--)
#define CLR(A,X) memset(A,X,sizeof(A))
#define IT iterator
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<PII> VII;
typedef vector<int> VI;
int vis[];
int num[];
int main()
{
ios::sync_with_stdio(false);
string s;
while(cin>>s){
int len=s.length();
CLR(vis,);
CLR(num,);
int ans=;
int cs=;
int k=len/;
if(k*!=len)ans=;if(ans){
char str=s[];
for(int i=;i<k;i++){
if(s[i]!=str)ans=;
}
str=s[k];
if(s[k]==s[k-])ans=;
for(int i=k;i<len-k;i++){
if(s[i]!=str)ans=;
}
str=s[len-k];
if(str==s[len-k-])ans=;
if(str==s[])ans=;
for(int i=len-k;i<len;i++){
if(s[i]!=str)ans=;
}
}
if(ans)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
} return ;
}

BestCoder Round #36 (hdu5198)Strange Class(水题)的更多相关文章

  1. BestCoder Round #36 (hdu5199)Gunner(水题)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Gunner Time Limit: 8000/4000 MS (Java/Oth ...

  2. BestCoder Round #36 (hdu5200)Strange Class(离线)

    转载请注明出处: http://www.cnblogs.com/fraud/          ——by fraud Trees Time Limit: 2000/1000 MS (Java/Othe ...

  3. Codeforces Round #373 (Div. 2) C. Efim and Strange Grade 水题

    C. Efim and Strange Grade 题目连接: http://codeforces.com/contest/719/problem/C Description Efim just re ...

  4. BestCoder Round #36

    HDU5198 Strange Class 问题描述 在Vivid的学校里,有一个奇怪的班级(SC).在SC里,这些学生的名字非常奇怪.他们的名字形式是这样的anbncn(a,b,c两两不相同.).例 ...

  5. Educational Codeforces Round 7 B. The Time 水题

    B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the curr ...

  6. Educational Codeforces Round 7 A. Infinite Sequence 水题

    A. Infinite Sequence 题目连接: http://www.codeforces.com/contest/622/problem/A Description Consider the ...

  7. VK Cup 2016 - Qualification Round 2 A. Home Numbers 水题

    A. Home Numbers 题目连接: http://www.codeforces.com/contest/638/problem/A Description The main street of ...

  8. BestCoder Round #11 (Div. 2) 前三题题解

    题目链接: huangjing hdu5054 Alice and Bob 思路: 就是(x,y)在两个參考系中的表示演全然一样.那么仅仅可能在这个矩形的中点.. 题目: Alice and Bob ...

  9. Codeforces Round #336 (Div. 2)-608A.水题 608B.前缀和

    A题和B题...   A. Saitama Destroys Hotel time limit per test 1 second memory limit per test 256 megabyte ...

随机推荐

  1. Windows环境变量修改

    做开发的时候都设置过Windows的环境变量,一直觉得实在是难用之极.网上搜索过解决方案,有个开源的小程序,试过,有问题,没有办法正常运行.所以自己写一个,权当练手. 下载地址:http://file ...

  2. Hbase常见异常

    1. HBase is able to connect to ZooKeeper but the connection closes immediately hbase(main):001:0> ...

  3. Javascript兼容收集

    1.IE6背景缓存 try{ document.execCommand("BackgroundImageCache", false, true); }catch(e){} 2. e ...

  4. HDU Today--hdu2112

    HDU Today Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  5. Java学习笔记--泛型

    一个泛型类就是具有一个或者多个类型变量的类. 我们可以只关注泛型,而不会为数据存储的细节而烦恼 . java泛型(一).泛型的基本介绍和使用 http://blog.csdn.net/lonelyro ...

  6. Android通过HTTP协议实现上传文件数据

    SocketHttpRequester.java package cn.itcast.utils; import java.io.BufferedReader; import java.io.Byte ...

  7. 【转】android 兼容性测试 CTS 测试过程(实践测试验证通过)

    原文网址:http://blog.csdn.net/jianguo_liao19840726/article/details/7222814 写这个博客的时候是为了记忆,建议大家还是看官方的说明,官方 ...

  8. JS 实现 startWith endWith函数

    String.prototype.startWith = function(s) { if (s == null || s == "" || this.length == 0 || ...

  9. Axure 原型设计工具画业务流程图

    加入人人都是产品经理[起点学院]产品经理实战训练营,BAT产品总监手把手带你学产品点此查看详情! 软件行业从业6年,流程图看过太多,大部分流程图是在考验阅读者的理解能力,近期在设计公司新版APP,对流 ...

  10. 【转】DM8168图像处理Link

    1> dei dei 主要做数据交错处理,带缩放 dei control data flow: 2> sclr 8168中支持缩放按比例的分子和分母,只支持缩小,貌似不支持放大,且注意输出 ...