import java.io.*;
import java.util.*;
public class Main {
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
static BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
public static void main(String[] args) throws IOException{
int a,c,p,q,r,x,temp;
String[] str;
str = br.readLine().split(" ");
a = Integer.parseInt(str[0]);
c = Integer.parseInt(str[1]);
p = Integer.parseInt(str[2]);
q = Integer.parseInt(str[3]);
r = Integer.parseInt(str[4]);
x = Integer.parseInt(str[5]);
temp = 0;
if(a < c){
if((c-a) * p >= x){
a += x / p;
out.write(a + "");
}
else{
x -= (c-a) * p;
temp = c;
if(q >= x){
out.write(temp + "");
}
else{
x -= q;
temp += x / r;
out.write(temp + "");
}
}
}
else if(a == c){
if(q >= x){
out.write(temp + "");
}
else{
x -= q;
temp = c;
temp += x / r;
out.write(temp + "");
}
}
else{
temp = a;
temp += x / r;
out.write(temp + "");
}
out.flush();
out.close();
br.close();
}
}
洛谷 P3926 SAC E#1 - 一道不可做题 Jelly Java
最新推荐文章于 2024-05-11 10:24:57 发布