转载请注明出处: 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. Lua 字符串 匹配模式 总结

    字符类 %a --字母alpha %d --数字double %l --小写字母lower %u --大写字母upper %w --字母和数字word %x -- 十六进制 %z --代表0 zero ...

  2. uva1368 DNA Consensus String

    <tex2html_verbatim_mark> Figure 1. DNA (Deoxyribonucleic Acid) is the molecule which contains ...

  3. 论如何进CSDN博客排名前500

    http://www.jtahstu.com/blog/post-71.html 目前该方法并不适用于博客园,显然写博客园的程序员智商要高些.

  4. LoadRunner参数化功能详解

    更新方式: .      Each Occurrence 每次遇到参数就进行更新. 多次使用同一参数,而且没有什么关联,例如随机数. Each Iteration 每次迭代时发生更新. 如果参数出现几 ...

  5. [Codeforces Round #192 (Div. 2)] D. Biridian Forest

    D. Biridian Forest time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  6. LeetCode_Palindrome Number

    Determine whether an integer is a palindrome. Do this without extra space. Some hints: Could negativ ...

  7. 微软推荐的Get a code signing certificate流程和链接

    Get a code signing certificate   Before you can establish a Windows Dev Center hardware dashboard ac ...

  8. mybatis批量update(mysql)

    Mapper文件中的写法 <insert id="batchUpdateTjData"> <foreach collection="list" ...

  9. JAVA Stack栈和Heap堆的区别(转)

          首先分清楚Stack,Heap的中文翻译:Stack—栈,Heap—堆.         在中文里,Stack可以翻译为“堆栈”,所以我直接查找了计算机术语里面堆和栈开头的词语:      ...

  10. [置顶] 【cocos2d-x入门实战】微信飞机大战之六:子弹层的处理

    这一篇将会处理完子弹层的其他要点. 1.子弹的初始位置 子弹的初始位置在飞机的机头位置,因为飞机在游戏的过程中会随着玩家的触摸而改变其位置,所以,子弹的初始位置只能以当前飞机位置为基准进行添加. CC ...