【CodeForces 699A】Launch of Collider
维护最新的R,遇到L时如果R出现过就更新答案。
#include <cstdio>
#include <algorithm>
using namespace std;
int n,x,r=-,ans=-;
char a[];
int main(){
scanf("%d%s",&n,a);
for(int i=;i<n;i++){
scanf("%d",&x);
if(a[i]=='R')
r=x;
else if(r>-)
ans=(ans==-)?(x-r)/:min(ans,(x-r)/);
}
printf("%d",ans);
}
【CodeForces 699A】Launch of Collider的更多相关文章
- 【codeforces 415D】Mashmokh and ACM(普通dp)
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...
- 【74.00%】【codeforces 747A】Display Size
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 【codeforces 707E】Garlands
[题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...
- 【codeforces 707C】Pythagorean Triples
[题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...
- 【codeforces 709D】Recover the String
[题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...
- 【codeforces 709B】Checkpoints
[题目链接]:http://codeforces.com/contest/709/problem/B [题意] 让你从起点开始走过n-1个点(至少n-1个) 问你最少走多远; [题解] 肯定不多走啊; ...
- 【codeforces 709C】Letters Cyclic Shift
[题目链接]:http://codeforces.com/contest/709/problem/C [题意] 让你改变一个字符串的子集(连续的一段); ->这一段的每个字符的字母都变成之前的一 ...
- 【Codeforces 429D】 Tricky Function
[题目链接] http://codeforces.com/problemset/problem/429/D [算法] 令Si = A1 + A2 + ... + Ai(A的前缀和) 则g(i,j) = ...
- 【Codeforces 670C】 Cinema
[题目链接] http://codeforces.com/contest/670/problem/C [算法] 离散化 [代码] #include<bits/stdc++.h> using ...
随机推荐
- umeng社交分享最新版5.0的跨进程使用崩溃的问题及解法-Android
先简单介绍下5.0版的变化.5.0最大的特色是调用简单,采用了链式语法,形如: new ShareAction(context).setPlatform(share_media) .withText( ...
- gitlab两种连接方式:ssh和http配置介绍
gitlab环境部署好后,创建project工程,在本地或远程下载gitlab代码,有两种方式:ssh和http (1)ssh方式:这是一种相对安全的方式 这要求将本地的公钥上传到gitlab中,如下 ...
- c语言:printf系列的函数
/** *----------------------------stdio.h--------------------------------------- * int printf(const c ...
- C语言:联合变量
#include <stdio.h> union hold{ int digit; double big; char letter; }; int main(){ union hold a ...
- 利用scp 远程上传下载文件/文件夹和ssh远程执行命令
利用scp传输文件 1.从服务器下载文件scp username@servername:/path/filename /tmp/local_destination例如scp codinglog@192 ...
- 如何将matlab画出的图片保存为要求精度
· 来源:http://emuch.net/bbs/viewthread.php?tid=2705843 杂志社对投稿图片的分辨率通常有如下要求: TIFF: Colour or greyscale ...
- 传递多个参数并获取Web API的数据
近段时间学习Web Api觉得非常有意思.默认的路由情况之下,获取数据时,它不必指定Action操作名. 还有另外感想,就是自从学习asp.net MVC之后,加上jQuery,让Insus.NET已 ...
- QT 数据库编程四
//vmysql.cpp #include "vmysql.h" #include <QMessageBox> Vmysql::Vmysql() { mysql_ini ...
- spring-自动加载配置文件\使用属性文件注入
在上一篇jsf环境搭建的基础上 , 加入spring框架 , 先看下目录结构 src/main/resources 这个source folder 放置web项目所需的主要配置,打包时,会自动打包到W ...
- 记一个全局变量"冒充"局部变量引起的bug
看代码相当简单直观,觉得怎么都不会出错,可运行结果明明就是错了 - 对着vim摸着脑袋就是想不出哪里有问题,可去掉新加的代码,就又可以了. 没办法,只好祭出杀手锏:一行一行注释掉来观察... 反映问题 ...