比赛 |
20160707 |
评测结果 |
RRRRRRRRRR |
题目名称 |
砍树 |
最终得分 |
0 |
用户昵称 |
Ceres |
运行时间 |
0.001 s |
代码语言 |
C++ |
内存使用 |
0.32 MiB |
提交时间 |
2016-07-07 16:28:08 |
显示代码纯文本
- #include <fstream>
- using namespace std;
- ifstream ci("abbreviation.in");
- ofstream co("abbreviation.out");
- int t;
- string st;
- int main()
- {
- ci>>t;getline(ci,st);
- for(int i=1;i<=t;i++)
- {
- getline(ci,st);
- int bn=0,s=0;
- for(int j=0;j<st.length();j++)
- {
- if(st[j]==' ')
- {
- bool k=1;
- if(s>=3)
- {
- if(st[bn]=='a' && st[bn+1]=='n' && st[bn+2]=='d')
- k=0;
- if(k && (st[bn]=='f' || st[bn]=='F') && st[bn+1]=='o' && st[bn+2]=='r')
- k=0;
- if(k && (st[bn]=='t' || st[bn]=='T') && st[bn+1]=='h' && st[bn+2]=='e')
- k=0;
- if(k)
- {
- if(st[bn]-'a'>=0)
- co<<char(st[bn]-'a'+'A');
- else
- co<<st[bn];
- }
- }
- s=0;
- bn=j+1;
- }
- else
- s++;
- if(j+1==st.length())
- {
- if(st[bn]-'a'>=0)
- co<<char(st[bn]-'a'+'A');
- else
- co<<st[bn];
- }
- }
- co<<endl;
- }
- ci.close();
- co.close();
- return 0;
- }