Platforms NEFU要崛起——第16场
来源:互联网 发布:逆袭网络剧第一集美拍 编辑:程序博客网 时间:2024/05/18 02:03
In one one-dimensional world there are n platforms. Platform with indexk (platforms are numbered from 1) is a segment with coordinates[(k - 1)m, (k - 1)m + l], andl < m. Grasshopper Bob starts to jump along the platforms from point0, with each jump he moves exactly d units right. Find out the coordinate of the point, where Bob will fall down. The grasshopper falls down, if he finds himself not on the platform, but if he finds himself on the edge of the platform, he doesn't fall down.
The first input line contains 4 integer numbers n,d, m,l (1 ≤ n, d, m, l ≤ 106, l < m) — respectively: amount of platforms, length of the grasshopper Bob's jump, and numbers m and l needed to find coordinates of the k-th platform:[(k - 1)m, (k - 1)m + l].
Output the coordinates of the point, where the grosshopper will fall down. Don't forget that if Bob finds himself on the platform edge, he doesn't fall down.
2 2 5 3
4
5 4 11 8
20
和超级玛丽一样的题
代码:
long long 于_int64的大小一样
#include<iostream>#include<cstdio>using namespace std;long long i,d,m,l,n,ans;long long i2,d2,m2,l2,n2,ans2;long long k;long long step;long long anss(long long n,long long d,long long m,long long l){ for (long long i=0;i<n;i++) { long long zuo=(i+1)*m; //第i+1个台子左边 long long you=i*m+l; //第i个台子右边 step=(you+d)/d; if (step*d<zuo) break; } return step;}int main(){ long long cas; long long a1,a2; long long c1,c2; while(cin>>n>>d>>m>>l) { c1=anss(n,d,m,l); cout<<c1*d<<endl; } return 0;}
- Platforms NEFU要崛起——第16场
- NEFU要崛起——第16场 A - Triangle
- NEFU要崛起——第16场 C - Stripe
- NEFU要崛起——第16场
- NEFU要崛起——第1场
- NEFU要崛起——第2场
- NEFU要崛起——第3场
- NEFU要崛起——第3场 A - Watermelon
- NEFU要崛起——第4场
- NEFU要崛起——第5场
- NEFU要崛起——第6场
- NEFU要崛起——第7场
- NEFU要崛起——第3场 A - Watermelon
- NEFU要崛起——第8场
- NEFU要崛起——第9场
- NEFU要崛起——第10场
- NEFU要崛起——第11~15场
- NEFU要崛起——第17场 A
- Android中ImageSwitcher结合Gallery展示SD卡中的资源图片
- Android中数据文件解析(Json解析【从服务器端获取数据并且解析,显示在客户端上面】)
- android 面试8:如何启用Service,如何停用Service
- [C++][Thread] 转:线程池原理及创建(C++实现)
- 杭电 1404
- Platforms NEFU要崛起——第16场
- ubuntu下配置NFS, tftp服务
- SharePoint 2010 配置可筛选的查阅项
- stm32移植ecos #4,移植redboot(ROM启动方式即内部flash启动)
- ADO.NET对象之 DataTable
- 我的程序员之路----2012在匍匐中前进
- android 获取网络图片显示在Gallery中
- 关于android 4.2源码 download及compile问题!
- VIM配置 自动安装