比赛 EYOI常规赛 1st 评测结果 RRRRRRRRRR
题目名称 奶牛晒衣服 最终得分 0
用户昵称 ui 运行时间 0.005 s
代码语言 C++ 内存使用 7.64 MiB
提交时间 2021-12-02 19:31:53
显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
const int N = 500000 + 500;
int n, a, b;
int p[N];
int t = 0;
bool cmp(int a, int b)
{
return a > b;	
}
int main()
{
//	freopen("dry.in","r",stdin);
//	freopen("dry.out","w",stdout);
cin >> n >> a >> b;	
 for(int i = 1; i <= n; i++)
 {
 scanf("%d", &p[i]);
 }
 sort(p+1, p+1+n, cmp);
 while(p[1] > 0)
 { 
 t++;
 p[1] = p[1] - a - b;
 for(int i = 2; i <= n; i++)
 {
 if(p[i] > 0)
 p[i] -= a;	
 }
 sort(p+1, p+1+n, cmp);

 }
 cout << t;
}