(codeforces)B. Bear and Different Names
来源:互联网 发布:郑州八度网络怎么样 编辑:程序博客网 时间:2024/06/06 10:39
どれでもドア:http://codeforces.com/problemset/problem/771/B
很有意思的一道题,题意也很简单
code
char c[6];int p=0,cnt=0;string getnewname(){ string name="A"; c[0]=c[1]=c[2]=c[3]=c[4]=c[5]='a'; c[p]=c[p]+cnt; for(int i=0;i<=p;i++){ name=name+c[i]; } cnt++; if(cnt==26){ cnt=0; p++; } return name;}int main(){ string str,prestr,s; int n,m; cin>>n>>m; vector<string> ans; n=n-m+1; for(int i=0;i<n;i++){ cin>>str; if(!i){ //prestr=str; for(int j=0;j<m;j++) ans.push_back(getnewname()); if(str=="NO") { ans.pop_back(); ans.push_back(ans[0]); } } else{ if(str=="YES"&&prestr=="YES") ans.push_back(getnewname()); else if(str=="NO"&&prestr=="NO"){ vector<string>::iterator it= ans.begin()+i; ans.push_back(*it); } else if(str=="NO"&&prestr=="YES"){ vector<string>::iterator it= ans.begin()+i; ans.push_back(*it); } else if(str=="YES"&&prestr=="NO"){ ans.push_back(getnewname()); } } prestr=str; } vector<string >::iterator it=ans.begin(); for(;it!=ans.end();it++){ cout<<*it<<" "; } cout<<endl; return 0;}
0 0
- (codeforces)B. Bear and Different Names
- codeforces Bear and Different Names
- Codeforces 771B Bear and Different Names[构造]
- CodeForces 791C Bear and Different Names
- CodeForces 791C Bear and Different Names
- Bear and Different Names
- Codeforces 791C Bear and Different Names 简单构造
- Codeforces Round #405 C. Bear and Different Names (思维)
- Codeforces Round #405 C.Bear and Different Names【思维】
- Codeforces Round #405 C. Bear and Different Names
- Codeforces 791 C. Bear and Different Names【贪心】
- (贪心)Codeforces Round #405 C. Bear and Different Names
- C. Bear and Different Names
- codefroces 791C Bear and Different Names
- Codeforces791 C. Bear and Different Names
- codeforce771B Bear and Different Names 贪心or思维
- Codeforces 385B Bear and Strings
- CodeForces 574B-Bear and Three Musketeers
- 初学Singleton单例模式
- 1046. Shortest Distance (20)
- 【HTML】学校宣传单
- 输出日期
- 打电话的3种方式
- (codeforces)B. Bear and Different Names
- Java配置----JDK开发环境搭建及环境变量配置
- bash博弈变体
- CSS
- 1047. Student List for Course (25)
- .net 在后置代码中输入JS提示语句(背景不会变白)
- double保留小数
- 活动选择问题
- Vi编辑器在编辑状态上下左右方向键和Backspace键“失灵”