Strange Class
来源:互联网 发布:上海至寻网络怎么样 编辑:程序博客网 时间:2024/06/06 03:07
Strange Class
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 675 Accepted Submission(s): 367
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.
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.
Please process to the end of file.
[Technical Specification]
|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
abcbc
Sample Output
YESNO#include<iostream>using namespace std;struct pt{char a;int t;}m[30];int main(){string s;while(cin>>s){int str = s.size() ;if(str%3 != 0){cout<<"NO"<<endl;continue;}int count = 1;m[0].a = s[0];m[0].t = 1;int j = 0;for(int i = 1; i< str; i ++){if(s[i] != s[i-1]){count++;m[++j].a = s[i];m[j].t = 1;}else{m[j].t ++;}}if(count != 3){cout<<"NO"<<endl;}else{if(m[0].t == m[1].t && m[1].t ==m[2].t ) cout<<"YES"<<endl; else cout<<"NO"<<endl;}//cout<<m[0].a <<" "<<m[1].a <<" "<<m[2].a <<endl;//cout<<m[0].t <<" "<<m[1].t <<" "<<m[2].t <<endl;}}
1Y。。。
0 0
- Strange Class
- Strange Class
- Strange Class
- hdu 5198 Strange Class
- HDU 5198 Strange Class
- HDU - 5198 - Strange Class
- 【BestCoder】HDU 5198 Strange Class
- HDU - 5198 - Strange Class && 5199 - Gunner
- BestCoder Round #36(Strange Class-模拟)
- HDU 5198 /BC 36A Strange Class
- hdu 5198 Strange Class(模拟)
- HDU-5198-Strange Class(Java+注意细节!)
- 暑假集训第三周周三赛 STL C - Strange Class 字符相同 SC数
- bestcoder#36-13981Strange Class字符串是否是a^n+b^n+c^n
- 【CUGBACM15级BC第36场 A】hdu 5198 Strange Class
- Strange Clock
- strange recursion
- Really Strange!!
- 关于低端外包
- C#加载滚动图片
- 教你怎么跳槽涨工资
- 简单学习STM32串口232
- P123.28
- Strange Class
- 微软100题(6) 根据上排给出十个数,在其下排填出对应的十个数
- mongodb学习(查询详解)
- 常用汉字的URL转义字符
- 最近
- 文章标题
- 3Sum
- 宏 备忘录
- hdu 5210 Delete