import java.io.*; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); while (true) { String[] strArray = br.readLine().split(" "); int a = Integer.parseInt(strArray[0]); // 物品总数 int b = Integer.parseInt(strArray[1]); // 挡板总数 int k = Integer.parseInt(strArray[2]); // 一个箱子最大隔间数 int v = Integer.parseInt(strArray[3]); // 一个隔间最多放物品数 int res = 0; // x * v + b * v >= a 推出 x >= a / v - b int x = a / v - b; res += x; while ((double) b / x > (double) (k - 1)) { res++; x++; } bw.write(res + "\n"); bw.flush(); } } }
点赞 评论

相关推荐

牛客网
牛客企业服务