1 solutions
-
0
C++ :
#include <bits/stdc++.h> using namespace std; priority_queue<int> sta; int main(){ int t=0,i,j,k,m,n,a,b; scanf("%d%d%d",&n,&a,&b); for(i=1;i<=n;i=-~i){ scanf("%d",&k); sta.push(k); } t+=a; k=sta.top(); sta.pop(); k-=b; sta.push(k); while(1){ k=sta.top(); sta.pop(); if(k-t<=0){ printf("%d",t/a); return 0; } t+=a; k-=b; sta.push(k); } return 0; }Pascal :
var p:array[1..1000000]of longint; n,a,b,max,i,x,ans:longint; begin readln(n,a,b); max:=0; for i:=1 to n do begin read(x);inc(p[x]);if x>max then max:=x;end; ans:=0; while ans*a<max do begin inc(ans); dec(p[max]); inc(p[max-b]); while p[max]=0 do dec(max); end; writeln(ans); end.
- 1
Information
- ID
- 19248
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By