看大佬的代码都好复杂(不愧是大佬\(orz\)

蒟蒻提供一种思路

因为求的是最近的车对吧\(qwq\)

所以我们可以用一个\(while\)循环所以没必要去用什么 \(for...\)

至于这是\(div2\)的第一题还是比较水的

#include <bits/stdc++.h>
#define rep(i,j,n) for(register int i=j;i<=n;i++)
#define Rep(i,j,n) for(register int i=j;i>=n;i--)
#define low(x) x&(-x)
using namespace std ;
typedef long long LL ;
const int inf = INT_MAX >> 1 ;
inline LL In() { LL res(0) , f(1) ; register char c ;
#define gc c = getchar()
while(isspace(gc)) ; c == '-' ? f = - 1 , gc : 0 ;
while(res = (res << 1) + (res << 3) + (c & 15) , isdigit(gc)) ;
return res * f ;
#undef gc
} int n , t ;
const int N = 100 + 5 ;
struct node {
int s , d ;
}a[N] ;
inline void Ot() {
n = In() , t = In() ;
rep(i,1,n) a[i].s = In() , a[i].d = In() ;
int tmp = inf ;
int ans = 0 ;
rep(i,1,n) {
int s = a[i].s ;
while(s < t) s += a[i].d ;
if(tmp > (s-t)) tmp = (s-t) , ans = i ;
}
cout << ans << endl ;
}
signed main() {
// freopen("test.in","r",stdin) ;
return Ot() , 0 ;
}

最新文章

  1. 搭建TFS 2015 Build Agent环境(一)
  2. 采用dom4j和反射模拟Spring框架的依赖注入功能
  3. CI3.0控制器下面建文件夹 访问一直404 的解决方法
  4. 股票数据调用示例代码php
  5. The Triumph Of Bio-logic
  6. pl/sql developer——instant-client 简单配置
  7. delphi 基础之三 文件流操作
  8. margin的重叠现象
  9. Bash shell 笔记总结(一) 转自http://www.bubuko.com/infodetail-509992.html,谢谢原作者
  10. vsftpd安装
  11. PAT (Advanced Level) 1114. Family Property (25)
  12. 使用Compute Shader加速Irradiance Environment Map的计算
  13. 编写自己的一个简单的web容器(二)
  14. AM335x(TQ335x)学习笔记——Nand&amp;&amp;网卡驱动移植
  15. 自定义EL函数(以将字母转为大写为例)
  16. django 图书管理系统
  17. FileSync文件同步更新工具
  18. Java Spring+Mysql+Mybatis 实现用户登录注册功能
  19. Python2.7-内置异常类型
  20. JFreeChart 之饼图

热门文章

  1. bzoj 2588 Spoj 10628. Count on a tree (可持久化线段树)
  2. Mybatis教程(一)
  3. 选择器的使用(not选择器)
  4. Array.prototype.map()方法详解
  5. mysql导入大型sql文件时注意事项
  6. UVa 340 Master-Mind Hints(猜数字游戏的提示)
  7. Linux命令输出头(标题)、输出结果排序技巧
  8. FTP Server完整篇 ubuntu 10.04
  9. HDU 5319 Painter(枚举)
  10. Jquery第四课 Javascript中this的使用方法