比赛 20160707 评测结果 RRRRRRRRRR
题目名称 砍树 最终得分 0
用户昵称 Ceres 运行时间 0.001 s
代码语言 C++ 内存使用 0.32 MiB
提交时间 2016-07-07 16:28:08
显示代码纯文本
  1. #include <fstream>
  2. using namespace std;
  3. ifstream ci("abbreviation.in");
  4. ofstream co("abbreviation.out");
  5. int t;
  6. string st;
  7. int main()
  8. {
  9. ci>>t;getline(ci,st);
  10. for(int i=1;i<=t;i++)
  11. {
  12. getline(ci,st);
  13. int bn=0,s=0;
  14. for(int j=0;j<st.length();j++)
  15. {
  16. if(st[j]==' ')
  17. {
  18. bool k=1;
  19. if(s>=3)
  20. {
  21. if(st[bn]=='a' && st[bn+1]=='n' && st[bn+2]=='d')
  22. k=0;
  23. if(k && (st[bn]=='f' || st[bn]=='F') && st[bn+1]=='o' && st[bn+2]=='r')
  24. k=0;
  25. if(k && (st[bn]=='t' || st[bn]=='T') && st[bn+1]=='h' && st[bn+2]=='e')
  26. k=0;
  27. if(k)
  28. {
  29. if(st[bn]-'a'>=0)
  30. co<<char(st[bn]-'a'+'A');
  31. else
  32. co<<st[bn];
  33. }
  34. }
  35. s=0;
  36. bn=j+1;
  37. }
  38. else
  39. s++;
  40. if(j+1==st.length())
  41. {
  42. if(st[bn]-'a'>=0)
  43. co<<char(st[bn]-'a'+'A');
  44. else
  45. co<<st[bn];
  46. }
  47. }
  48. co<<endl;
  49. }
  50. ci.close();
  51. co.close();
  52. return 0;
  53. }