Nuts

input
standard input
output
standard output

You have a nuts and lots of boxes. The boxes have a wonderful feature: if you put x (x ≥ 0) divisors (the spacial bars that can divide a box) to it, you get a box, divided into x + 1 sections.

You are minimalist. Therefore, on the one hand, you are against dividing some box into more than k sections. On the other hand, you are against putting more than v nuts into some section of the box. What is the minimum number of boxes you have to use if you want to put all the nuts in boxes, and you have b divisors?

Please note that you need to minimize the number of used boxes, not sections. You do not have to minimize the number of used divisors.

Input

The first line contains four space-separated integers kabv (2 ≤ k ≤ 10001 ≤ a, b, v ≤ 1000) — the maximum number of sections in the box, the number of nuts, the number of divisors and the capacity of each section of the box.

Output

Print a single integer — the answer to the problem.

Sample test(s)
input
3 10 3 3
output
2
input
3 10 1 3
output
3
input
100 100 1 1000
output
1
/*#include<stdio.h>
int main()
{
    int k,a,b,v,s=0,e=0,m=0,l=0,h=0,i;
    scanf("%d %d %d %d",&k,&a,&b,&v);
    if(b+1>k&&a>0)
    {
        l=b/(k-1);
        h=b%(k-1);
        for(i=1; i<=l; i++)
            if(a-(i*v*k)>=k*v&&a-(i+1)*v*k<k*v)
            {
                l=i+1;
                break;
            }
        a-=l*v*k;
        m+=l;
        if(h>0&&a>0)
        {
            a-=(h+1)*v;
            m++;
        }
    }
    else if(b+1<k&&a>0)
    {
        a-=(b+1)*v;
        m++;
    }
    if(a>0)
    {
        e=a%v;
        s=a/v;
        m+=s;
    }
    if(e>0)
        m++;
    printf("%d\n",m);
    return 0;
}*/

#include<stdio.h>

int k,a,b,v,ans;
int main()
{
    scanf("%d %d %d %d",&k,&a,&b,&v);
    ans=a/v;
    if(a%v!=0)ans++;
    if(ans<=b+1)
    {
                if(ans%k==0)ans/=k;
                else ans=ans/k+1;
                }
    else ans=ans-b;
    printf("%d",ans);
    return 0;
    }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
root过程: 关机 将手机连接电脑(连接方法:先将edl线一头连接到手机,然后用手捏住绿色和黑色线露出的铜线,不要害怕短路,没事的,然后另一头连接电脑,几秒后松开捏住的绿线和黑线,就成功进入9008线刷模式了,可以在电脑上右键此电脑-管理-设备管理器,如果看到9008的端口就代表成功了) 进入9008模式后 安装高通驱动 解压并安装QPST工具 运行Qfil 选择“Flat Build” 选择程序"Browse" 选择"prog_emmc_ufs_firehose_Sdm660_ddr.elf" 点击“Load XML”并选择“rawprogram_unsparse.xml”,然后选择“patch0.xml” 点击"Download" 等待(QFIL会通知一个错误,这是正常的) 重启手机 手机安装magisk manager 打开MagiskManager 点“安装” 注意!!!如果你的系统版本是内测版4.5版本,那就点击直接安装 如果你的系统不是4.5内测版,那就要patch对应的boot.img,否则安装后系统无法打开WiFi patch方法: 我这儿用4.2版本举例,先下载4.2版本的全量卡刷包。下载后解压出boot文件,只需解压出boot文件就行了,将boot文件复制到手机里,方法跟刚才一样,打开magisk manager,点击第二个修复镜像,选择刚才解压出的boot文件,会提示正在下载magisk v16,下载好了会自动刷入,刷入成功后手机根目录/magisk manager文件夹下会出现新的patch好的boot文件,然后我们去网上下载一个叫flashify的app,安装,打开,点刷boot,然后刷入我们刚才patch好的boot文件, 重启,OK,大功告成 注意:暂时没找到方法使用xp模块,所以不要安装刷入XP框架,否则会无限重启,无限重启,无限重启

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值