Codeforces 699A. Launch of Collider (模拟)
来源:互联网 发布:国外科学网站知乎 编辑:程序博客网 时间:2024/06/07 09:31
题目链接
题目大意
有一堆点在一条直线上,一些往左飞,一些往右飞,速度都是1,问第一次出现碰撞的时刻。
思路
只有RL这样的两个点才可能碰撞,扫一遍,记录碰撞的最小时间就行了
代码
include <bits/stdc++.h>using namespace std;const int maxn = 2e6+10;int pos[maxn];int main(){ int n; cin >>n; string str; cin >>str; int mi = 1e9 + 10; for(int i = 0 ; i < n ; i ++){ scanf("%d", pos +i); if(i){ if(str[i] == 'L' && str[i-1] == 'R') mi = min((pos[i] - pos[i-1]) /2,mi); } } if(mi == 1e9+10) mi = -1; printf("%d",mi);}
0 0
- 【模拟】Codeforces 699A Launch of Collider
- Codeforces 699A. Launch of Collider (模拟)
- Codeforces 699A Launch of Collider
- Codeforces 699A Launch of Collider
- Codeforces-699A Launch of Collider
- CodeForces 699A Launch of Collider
- CodeForces 699A Launch of Collider
- CodeForces 699A Launch of Collider
- codeforces 699 A. Launch of Collider
- codeforces 699A Launch of Collider
- 【CodeForces】699A - Launch of Collider(思维)
- 【Codeforces】-699A-Launch of Collider(思维)
- CodeForces 699 A. Launch of Collider(水~)
- CodeForces 699 A. Launch of Collider(水)
- A. Launch of Collider
- Codeforces Round #363(Div. 2) A. Launch of Collider【模拟】 && B. One Bomb【暴力】
- Codeforces Round #363 (Div. 2)[A]Launch of Collider
- Codeforces #363 (Div.2) A. Launch of Collider【水题】
- Openstack liberty 云主机迁移源码分析之静态迁移1
- xtion pro live 单目视觉半直接法(SVO)实践
- MangoDB 实例
- android实现退出时关闭所有activity
- POJ 3264 Balanced Lineup(水题试ST算法模板)
- Codeforces 699A. Launch of Collider (模拟)
- Ext.QuickTips
- Centos + CUDA7.5 + caffe配置教程
- thinkphp中find()和select的区别
- typeError: $(...).ajaxSubmit is not a function
- kerl与eclipse中的erlang插件问题记录
- Filter过滤器详解
- php 上传大文件主要涉及配置upload_max_filesize和post_max_size两个选项
- Swift 字符串切割 java substring