比赛 |
20151019 |
评测结果 |
AAAAAATTTT |
题目名称 |
爬山 |
最终得分 |
60 |
用户昵称 |
蜗牛哲 |
运行时间 |
4.721 s |
代码语言 |
C++ |
内存使用 |
0.31 MiB |
提交时间 |
2015-10-19 21:14:54 |
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<climits>
using namespace std;
int n,d,a,b;
int ans;
double tup,tdown;
int main()
{
freopen("mountain.in","r",stdin);
freopen("mountain.out","w",stdout);
scanf("%d%d%d%d",&n,&d,&a,&b);
ans=b;
while(tup+tdown<=n-1)
{
ans++;
tup=((ans-a)/(1.0*d));
tup=ceil(tup);
tdown=((ans-b)/(1.0*d));
tdown=ceil(tdown);
}
cout<<ans-1<<endl;
return 0;
}