Codeforces #380 div2 C(729C) Road to Cinema】的更多相关文章

C. Road to Cinema time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t m…
题目链接 http://codeforces.com/problemset/problem/729/C 题意:n个价格c[i],油量v[i]的汽车,求最便宜的一辆使得能在t时间内到达s,路途中有k个位置在g[i]的加油站,可以免费加满油,且不耗时间.每辆车有两种运行模式可以随时切换:1.每米一分钟两升油:2.每米两分钟一升油. 看到10^5次加上循环两次就想到二分或者线段树或者看错题意了. 这题二分查找一下汽油就可以了,找到最少多少汽油够到达,然后再for一遍找汽油量大的且价格便宜的车即可. 还…
E. Subordinates time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n workers in a company, each of them has a unique id from 1 to n. Exaclty one of them is a chief, his id is s. Each…
D. Sea Battle time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships con…
B. Spotlights time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Theater stage is a rectangular field of size n × m. The director gave you the stage's plan which actors will follow. For each c…
C. Road to Cinema time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t m…
题目链接:http://codeforces.com/problemset/problem/729/C C. Road to Cinema time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya is currently at a car rental service, and he wants to reach cinem…
// Codeforces #180 div2 C Parity Game // // 这个问题的意思被摄物体没有解释 // // 这个主题是如此的狠一点(对我来说,),不多说了这 // // 解决问题的思路: // // 第一个假设a字符串和b字符串相等,说直接YES // 假设b串全是0,直接YES // 注意到a串有一个性质,1的个数不会超过本身的加1. // a有个1的上限设为x,b有个1的个数设为y,则假设x < y // 那么直接NO. // // 如今普通情况下.就是模拟啦,找到a…
Road to Cinema time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minu…
Problem   Codeforces #541 (Div2) - E. String Multiplication Time Limit: 2000 mSec Problem Description Input Output Print exactly one integer — the beauty of the product of the strings. Sample Input 3aba Sample Output 3 题解:这个题的思维难度其实不大,需要维护什么东西很容易想到,或…
Problem   Codeforces #541 (Div2) - F. Asya And Kittens Time Limit: 2000 mSec Problem Description Input The first line contains a single integer nn (2≤n≤150000) — the number of kittens. Each of the following n−1lines contains integers xi and yi (1≤xi,…
Problem   Codeforces #541 (Div2) - D. Gourmet choice Time Limit: 2000 mSec Problem Description Input Output The first line of output should contain "Yes", if it's possible to do a correct evaluation for all the dishes, or "No" otherwis…
Problem   Codeforces #548 (Div2) - D.Steps to One Time Limit: 2000 mSec Problem Description Input The first and only line contains a single integer mm (1≤m≤100000,1≤m≤100000). Output Print a single integer — the expected length of the array aa writte…
# [Codeforces #312 div2 A]Lala Land and Apple Trees 首先,此题的大意是在一条坐标轴上,有\(n\)个点,每个点的权值为\(a_{i}\),第一次从原点开始走,方向自选(<- or ->),在过程中,若遇到一个权值>0的点,则将此权值计入答案,并归零.当次.此方向上的所有点均为0后,输出此时的答案. 然后,进行分析: 我们很容易想到这是一个贪心,我们将正的和负的分别存入两个数组,最初的方向为: \(zhengsum > fusum…
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a str…
C. Cinema time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Moscow is hosting a major international conference, which is attended by n scientists from different countries. Each of the scient…
1.字符串替换ogo+go…换成*** 思路:找ogo记录g位置,做初步替换和标记,非目标字母直接输出, 间隔为2的判断是否一个为标记g,一个为非标记做***替换 #include<iostream> using namespace std; bool mark[110] = { 0 }; int tol = 0; int main() { char a[110]; int b[110]; int n, tol = 0, cnt = 0; cin >> n >> a;…
二分答案. 油量越多,显然通过的时间越少.可以二分找到最小的油量,可以在$t$时间内到达电影院. 一个油箱容量为$v$的车通过长度为$L$的路程需要的最小时间为$max(L,3*L-v)$.计算过程如下: 假设普通速度运行了距离$a$,加速运行了距离$b$,则$a+b=L$,即$b=L-a$. 因为$a+2*b≤v$,所以$a≥2*L-v$.所花时间为$2*a+b≥3*L-v$,因为最小需要$L$的时间,所以取个$max$.按照$max(L,3*L-v)$一段一段加起来验证就可以了. #prag…
比赛链接:http://codeforces.com/contest/462 这次比赛的时候,刚刚注冊的时候非常想好好的做一下,可是网上喝了个小酒之后.也就迷迷糊糊地看了题目,做了几题.一觉醒来发现rating掉了非常多,那个心痛啊! 只是.后来认真的读了题目,发现这次的div2并非非常难! 官方题解:http://codeforces.com/blog/entry/13568 A. Appleman and Easy Task 解析:         一个水题,推断每一个细胞周围是否都是有偶数…
  ~A题 A. Cards time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n cards (n is even) in the deck. Each card has a positive integer written on it. n / 2 people will play new card gam…
D. Directed Roads time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output ZS the Coder and Chris the Baboon has explored Udayland for quite some time. They realize that it consists of n towns numbered…
题目链接:http://codeforces.com/contest/699/problem/C dp[i][j]表示第i天做事情j所得到最小的假期,j=0,1,2. #include<bits/stdc++.h> using namespace std; const int INF=0x3f3f3f3f; int dp[105][3]; int main() { int n; scanf("%d",&n); memset(dp,INF,sizeof(dp)); d…
题目链接:http://codeforces.com/contest/706/problem/C #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e5+3; const ll INF=1e18; ll dp[N][2]; string a[N],b[N]; int c[N]; int main() { int n; scanf("%d",&n); for(…
题目:http://codeforces.com/contest/401/problem/C 题意:n个0,m个1,求没有00或111的情况. 这么简单的题..... 做题的时候脑残了...,今天,贴一下ac的代码,警示一下自己 #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> using namespa…
ABC见上一篇. 感觉这场比赛很有数学气息. D: 显然必须要贴着之前的人坐下. 首先考虑没有限制的方案数.就是2n - 1(我们把1固定,其他的都只有两种方案,放完后长度为n) 我们发现对于一个限制,比它小的限制只有可能在它的一边. 于是对于有限制的一段,我们可以找到最靠近边界的两个限制,取其中最大的限制,递归计算向比它小的限制的方向走它的限制步所覆盖的一段,这一段应该包含目前区间内所有的限制,剩下的就是没有限制的,可以直接计算. mycode: /* * Problem: Sereja an…
D - Toll RoadTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=87493#problem/D Description Exactly N years ago, a new highway between two major cities was built. The highway runs from west to east. It…
A:A. Points and Segments (easy) 题目看了n久,開始认为尼玛这是div2的题目么,题目还标明了easy.. 意思是给你一n个点,m个区间,在n个点上放蓝球或者红球,然后让你找一种选择方案使得m个区间内的蓝球和红球数量之差不超过1. 開始想过用dfs,只是这仅仅是div2的A题而已.. 然后想了下,直接输出010101序列不就能够么. 交了一发,发现要先排个序,再输出就能够了. AC代码: #include<iostream> #include<cstdio&…
职务地址:http://codeforces.com/contest/460/problem/C 这个题是用二分枚举最小值.然后推断是否能在规定的次数内使得全部的数都达到这个值.推断的时候要用贪心的方法推断,从左往右遍历.这时候须要让每次浇花的范围尽量向右.所以当到达一个不得不浇花的地方时,要继续占用所须要的浇花次数.当浇花次数不够用的时候,就说明无法达到. 在我的代码中,c数组是记录当前到了该点的时候浇花范围的最右界.表示到了这个地方的时候少了多少次覆盖.y就代表当前这个数被多少个浇花范围覆盖…
题目链接:http://codeforces.com/contest/738 A题:SB题. B题:SB题. C题:二分. D题:贪心. E题:乱搞. F题:设f[i][j][k]代表甲先手,左边消去了i个,右边消去了i+j个,上一次消去k个时答案.g[i][j][k]乙先手.可以证明j<=sqrt(2n),k<=sqrt(2n).o(n^2). 代码: A: #include<cstdio> #include<cstring> #include<algorith…