比赛 20121023 评测结果 AAAAAAAAAA
题目名称 奶牛晒衣服 最终得分 100
用户昵称 Makazeu 运行时间 1.365 s
代码语言 C++ 内存使用 0.27 MiB
提交时间 2012-10-23 19:27:37
显示代码纯文本
  1. #include <cstdio>
  2. #include <cstdlib>
  3. #include <set>
  4. #include <algorithm>
  5. using namespace std;
  6. multiset<int> hash;
  7. int N,A,B,x,ans=0;
  8. int main()
  9. {
  10. freopen("dry.in","r",stdin);
  11. freopen("dry.out","w",stdout);
  12. scanf("%d %d %d\n",&N,&A,&B);
  13. for(int i=1;i<=N;i++)
  14. {
  15. scanf("%d\n",&x); hash.insert(x);
  16. }
  17. multiset<int> :: iterator iter;
  18. while(hash.size())
  19. {
  20. iter=hash.end(); iter--; x=*iter;
  21. if(x<=ans*A) break; ans++;
  22. x-=B; hash.erase(iter);
  23. if(x>0) hash.insert(x);
  24. }
  25. printf("%d\n",ans);
  26. return 0;
  27. }