CodeForces 706A Beru-taxi】的更多相关文章

http://codeforces.com/problemset/problem/158/B B. Taxi time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output After the lessons n groups of schoolchildren went outside and decided to visit Polyca…
题目链接: http://codeforces.com/problemset/problem/706/A 题目大意: 家的坐标在sx,sy,有n辆车,每辆车坐标xi,yi,速度vi,问最快的一辆车什么时候到家. 题目思路: [模拟] 签到题. // //by coolxxx // #include<iostream> #include<algorithm> #include<string> #include<iomanip> #include<memo…
B. Taxi time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that th…
题目链接: A. Beru-taxi 题意: 问那个taxi到他的时间最短,水题; AC代码: #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <bits/stdc++.h> #include <stack> #include <map> using n…
题意:给定一个固定位置,和 n 个点及移动速度,问你这些点最快到固定点的时间. 析:一个一个的算距离,然后算时间. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostream> #in…
[题目链接]click here~~ [题目大意]n组团体去包车,每组团体的人数<=4,一辆车最多容纳4人,求所求车的数目最小 [解题思路]:思路见代码~~ // C #ifndef _GLIBCXX_NO_ASSERT #include <cassert> #endif #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <…
简单题. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vector> #include<map> #include<set> #include<queue> #inc…
[链接] 我是链接,点我呀:) [题意] 每辆车可以载重4个人. 一共有n个组,每个组分别有s[i]个人. 要求每个组的人都在同一辆车里面. 问最少需要多少辆车 [题解] 将每个组的人数从小到大排序. 然后逆序枚举每个组r. 显然这个组肯定要占用一辆车. 那么现在问题就变成尽可能多带几个人在这一辆车里面. 那么就找人数最小的几个组就好(这样一辆车里面的人能多一点.) [代码] import java.util.Arrays; import java.util.Scanner; public cl…
传送门:QAQQAQ 题意:给你一个图,每条边有边权,现在你可以对边进行反转,使图中不存在环,你需要使得反转的边的边权集合中的最大值最小,并输出任意一组解. 思路:二分+拓扑排序 使得最大值最小,自然而然想到二分(其实我先想到tarjan,发现环套环无法处理) 那么我们二分枚举答案,把小于mid的边全部拆了,判断剩下边是否成环(dfs,之前染色方法玄学错误),若没有环则当前mid成立 为什么呢?——如果我们把一条删掉的边连上,无论怎么摆都会形成一个环,那么原先的边一定有一条大环,所以原先这种情况…
CodeForces - 158B.Taxi (贪心) 题意分析 首先对1234的个数分别统计,4人组的直接加上即可.然后让1和3成对处理,只有2种情况,第一种是1多,就让剩下的1和2组队处理,另外一种是3多,那么结果就加上3的个数,再单独处理2. 对于1和2组队处理的讨论:首先分配2,有2种情况,一种是2正好分配完了,另外一种就2还剩下2个人(正好剩下1组).就一起处理这个2个人和1剩下的人. 把每次处理的结果都加起来即可. 代码 #include <iostream> #include &…