比赛 防止颓废的小练习v0.15 评测结果 WAWAWWWWWW
题目名称 统计单词数 最终得分 20
用户昵称 Aeons 运行时间 0.077 s
代码语言 C++ 内存使用 0.32 MiB
提交时间 2016-10-17 20:50:13
显示代码纯文本
  1. #include <fstream>
  2. #include <string>
  3. using namespace std;
  4. ifstream fin("stat.in");
  5. ofstream fout("stat.out");
  6.  
  7. int main()
  8. {
  9. string n;
  10. int i=1,j;
  11. int ans=0;
  12. string l;
  13. int k=1;
  14. int p;
  15. int t1=l.length();
  16. fin>>l;
  17. while(!fin.eof())
  18. {
  19. fin>>n;
  20. int t2=n.length();
  21. if(t2==t1)
  22. {
  23. for(j=0;j<t1;j++)
  24. {
  25. if(n[j]==l[j])
  26. k++;
  27. if(n[j]>='A'&& n[j]<='Z')
  28. if(n[j]+'a'-'A'==l[j])
  29. k++;
  30. if(n[j]>='a'&& n[j]<='z')
  31. if(n[j]-('a'-'A')==l[j])
  32. k++;
  33. if(n[j]!=l[j])
  34. break;
  35. }
  36. if(k==t1)
  37. {
  38. ans++;
  39. if(ans=1);
  40. p=i;
  41. }
  42. k=1;
  43. }
  44. i++;
  45. }
  46. if(ans!=0)
  47. fout<<ans<<' '<<p;
  48. if(ans==0)
  49. fout<<-1<<endl;
  50. fin.close();
  51. fout.close();
  52. return 0;
  53. }