记录编号 186723 评测结果 AAAAAAAAAA
题目名称 [NOIP 2014PJ]珠心算测试 最终得分 100
用户昵称 GravatarWangQL. 是否通过 通过
代码语言 C++ 运行时间 0.006 s
提交时间 2015-09-14 20:26:40 内存使用 0.31 MiB
显示代码纯文本
  1. #include <fstream>
  2. #include <algorithm>
  3. using namespace std;
  4. int main()
  5. {
  6. ifstream fin("countb.in");
  7. ofstream fout("countb.out");
  8. int i,j,k,m,count[10001],ans=0,more[10001];
  9. fin>>m;
  10. for(i=1;i<=m;i++)
  11. {
  12. fin>>count[i];
  13. more[i]=count[i];
  14. }
  15. sort(count,count+m+1);
  16. sort(more,more+m+1);
  17. for(j=1;j<=m;j++)
  18. for(k=2;k<=m;k++)
  19. for(i=1;i<=m;i++)
  20. {
  21. if((count[j]+count[k]==more[i])&&j!=k&&count[i]!=count[j])
  22. {
  23. ans++;
  24. more[i]=0;
  25. }
  26. }
  27. fout<<ans<<endl;
  28. fin.close();
  29. fout.close();
  30. return 0;
  31. }