比赛 20121023 评测结果 AAAAAAAAAA
题目名称 奶牛晒衣服 最终得分 100
用户昵称 feng 运行时间 0.269 s
代码语言 C++ 内存使用 2.60 MiB
提交时间 2012-10-23 19:41:55
显示代码纯文本
  1. #include<cstdio>
  2. #include<cstring>
  3. #include<algorithm>
  4. #include<iostream>
  5. using namespace std;
  6. int n,a,b,x,maxn,o,i;
  7. int f[600000];
  8.  
  9. int main()
  10. {
  11. freopen("dry.in","r",stdin);
  12. freopen("dry.out","w",stdout);
  13. scanf("%d%d%d",&n,&a,&b);
  14. memset(f,0,sizeof(f));
  15. maxn=0;
  16. for (i=1;i<=n;i++){
  17. scanf("%d",&x);
  18. if (x>maxn) maxn=x;
  19. f[x]++;
  20. }
  21. o=0;
  22. for (i=maxn;i>=1;i--){
  23. while (f[i]>0){
  24. if (i<=o){
  25. printf("%d",o/a);
  26. return 0;
  27. }
  28. f[i]--;
  29. if ((i-b)>o)
  30. f[i-b]++;
  31. o+=a;
  32. }
  33. }
  34. return 0;
  35. }