codeforces #363a Launch of Collider】的更多相关文章

A. Launch of Collider time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n parti…
题目链接: http://codeforces.com/problemset/problem/699/A 题目大意: 给N个点,向左或向右运动,速度均为1,问最早什么时候有两个点相撞.无解输出-1 题目思路: [模拟] 模拟一下,记录往左往右的位置即可. // //by coolxxx ////<bits/stdc++.h> #include<iostream> #include<algorithm> #include<string> #include<…
枚举相邻两个$a[i]$与$a[i+1]$,如果$s[i]=R$并且$s[i+1]=L$,那么$i$和$i+1$会碰撞,更新答案. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vector> #incl…
A. Launch of Collider time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n parti…
A. Launch of Collider time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n parti…
A. Launch of Collider time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output   There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n par…
维护最新的R,遇到L时如果R出现过就更新答案. #include <cstdio> #include <algorithm> using namespace std; int n,x,r=-1,ans=-1; char a[200005]; int main(){ scanf("%d%s",&n,a); for(int i=0;i<n;i++){ scanf("%d",&x); if(a[i]=='R') r=x; el…
模拟算盘 #include<bits/stdc++.h> using namespace std; int main() { char s[20]; scanf("%s",&s); int len=strlen(s); for(int i=len-1;i>=0;i--) { if(s[i]>='5'&&s[i]<='9') { printf("-O|"); for(int j=1;j<=s[i]-'5';j…
#include<stdio.h>//这题挺有意思小学学的算盘 int main() { int n,i,m; while(scanf("%d",&n)!=EOF) { if(n==0) { printf("O-|-OOOO\n"); continue; } while(n) { m=n%10; if(m>=5) { printf("-O|"); m-=5; } else printf("O-|");…
Content 有 \(n\) 辆车在一条数轴上,第 \(i\) 辆车在 \(a_i\) 上,每辆车要么向左,要么向右.开始,它们以 \(1\) 个单位每秒的速度在行驶.问你第一次撞车发生在第几秒的时候,或者根本不会撞车. 数据范围:\(1\leqslant n\leqslant 2\times 10^5,0\leqslant x_i\leqslant x_{i+1}\leqslant 10^9\). Solution 我们可以很容易的发现,当且仅当相邻的两个车,左边的向右开,右边的向左开时会发…