| 比赛 | 20151019 | 评测结果 | WWWAAAWAWW |
|---|---|---|---|
| 题目名称 | 爬山 | 最终得分 | 40 |
| 用户昵称 | KZNS | 运行时间 | 0.003 s |
| 代码语言 | C++ | 内存使用 | 0.31 MiB |
| 提交时间 | 2015-10-19 20:46:01 | ||
// KZ's
#include <fstream>
using namespace std;
int main() {
ifstream fin ("mountain.in");
ofstream fout ("mountain.out");
int a,b,d;
long long n;
fin>>n>>d>>a>>b;
if(a<b)
fout<<((b-a)/d+n-1)/2*d+a<<endl;
else
fout<<((a-b)/d+n-1)/2*d+b<<endl;
return 0;
}
// UBWH