#include<stdio.h> int main(){ printf("PTA shi3 wo3 jing1 shen2 huan4 fa1 !"); return 0; }
#include<iostream> #include<string> using namespace std; int main(void) { string str; getline(cin, str); for (int i = 0; i < str.length(); i++) { if (str[i] != '6') cout << str[i]; else { int count = 0; for (; str[i] == '6'; i++) count++; i--; if (count <= 3) { for (int j = 0; j < count; j++) cout << 6; } if (count > 3 && count <= 9) cout << 9; if (count > 9) cout << 27; } } }
#include<iostream> #include<string> using namespace std; string s; int f1, f2; int main() { int n; cin >> n; getchar(); while(n -- ) { getline(cin, s); for(int i = 0; i < s.size(); i ++ ) { if(s[i] == ',')//判断逗号前面是不是ong { if(s[i - 1] == 'g' && s[i - 2] == 'n' && s[i - 3] == 'o') f1 = 1; } if(s[i] == '.')//判断句号前面是不是ong { if(s[i - 1] == 'g' && s[i - 2] == 'n' && s[i - 3] == 'o') f2 = 1; } } int sum = 0, dot = 0; if(f1 == 1 && f2 == 1) { for(int i = 0; i < s.size(); i ++ ) { if(s[i] == ',') { dot = i; for(int j = i; j < s.size(); j ++ ) { if(s[j] == ' ') sum ++ ; } } } //输出操作 for(int i = 0; i <= dot; i ++ ) cout << s[i];//输出前一句和, for(int i = dot + 1; ; i ++ ) { cout << s[i];//输出逗号后面的,除最后三个 if(s[i] == ' ') sum -- ; if(sum == 2) break; } cout << "qiao ben zhong."; }//if(f1 == 1 && f2 == 1) else cout << "Skipped"; cout << endl;//换行 f1 = f2 = 0;//标记复原 } return 0; }
标签:&&,int,7.27,++,str,include,size From: https://www.cnblogs.com/xuxingkai/p/17585685.html