比赛 |
20121023 |
评测结果 |
AEEEEEEEEE |
题目名称 |
奶牛晒衣服 |
最终得分 |
10 |
用户昵称 |
临轩听雨ゐ |
运行时间 |
0.705 s |
代码语言 |
C++ |
内存使用 |
0.28 MiB |
提交时间 |
2012-10-23 21:59:13 |
显示代码纯文本
- #include <fstream>
- #include <cstdlib>
- #include <cstdio>
- using namespace std;
- int comp(const void *i1, const void *i2)
- {
- return *(int*)i2-*(int*)i1;
- }
-
- int main()
- {
- ifstream in("dry.in");
- ofstream out("dry.out");
- int cloth[10];
- int a=0, b=0, n=0;
- in>>n>>a>>b;
- for(int i = 0; i < n; i++)
- in>>cloth[i];
- int time = 0;
- qsort(cloth, n, sizeof(int), comp);
- while(cloth[0]!=0)
- {
- for(int i = 0; i < n; i++)
- {
- if(i==0)
- if(cloth[i]>=a+b)
- cloth[i]-=(a+b);
- else
- cloth[i]=0;
- else
- if(cloth[i]>=a)
- cloth[i]-=a;
- else
- cloth[i]=0;
- }
- time++;
- qsort(cloth, n, sizeof(int), comp);
- }
- out<<time<<endl;
- }