题目连接 题意: n个学生出去玩,要前进一段距离,租了一辆可以载k个人的车,问到达到目的地的最短时间. cin: n,l,v1,v2,k. £:所有人一起到达终点的时候时间最短. £:所有人走路和坐车的时间相等. 法一:公式推导: •求批次: if(n%k) cnt=n/k+1; else cnt=n/k; •设第一批人到达坐车到处下车,乘车时间为: •车返回去接第二批人与第二批人相遇所用的时间为,相遇的地点为;则第二批人走的距离和车从到的距离和为 •车接第批人,第批人走的距离为,最后一批人在处…
D. As Fast As Possible 参考:https://blog.csdn.net/keyboardmagician/article/details/52769493 题意: 一群大佬要走L米,途中可以直接上车,大佬的速度为v1,车的速度为v2,车的位子有限,问大佬们到终点的时间最快是多少. 每个人只能坐一次车. 思路: 这类奥数题真难.有一个比较重要的转化,就是在设定的t时间下,公交车的时间就是全部大佬到终点的时间. 每个人只能坐一次车,所以最后到达终点的人决定总时间,可以看出,用…
 D. As Fast As Possible time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output On vacations n pupils decided to go on excursion and gather all together. They need to overcome the path with the len…
A. Plus and Square Root 题目连接: http://codeforces.com/contest/715/problem/A Description ZS the Coder is playing a game. There is a number displayed on the screen and there are two buttons, ' + ' (plus) and '' (square root). Initially, the number 2 is d…
题目链接:http://codeforces.com/contest/701/problem/D 题意: 给出n个学生和能载k个学生的车,速度分别为v1,v2,需要走一段旅程长为l,每个学生只能搭一次车,问最少时间到达目的地. 分析: 要使得时间最少,最后车和所有学生应该是同时到达的,我们可以观察到第一组乘车的学生和最后一组乘车的学生两者搭车时间和走路时间是相同的,那么猜想中间所有组的的学生乘车时间和走路时间是相同的(不是乘车==走路),即所有学生的乘车时间相同,走路时间相同.那么第一组学生时间…
一种方法是二分总时间,复杂度O(nlogn). 另外我们可以证明,当所有人同时到达终点的时候,是最优的,因为没有人的时间“浪费”了. 我们又发现,每个人的运动过程总是两段,要么是走路,要么是坐车.于是每个人的运动都是等价的(坐车的时间也相等,走路的时间也相等). 这里借用一下这个推导,懒得写了. (http://blog.csdn.net/say_c_box/article/details/52001850) 根据上面的过程得出d以后,于是有d*(组数-1)+l1=l,然后就可以解出l1,然后l…
题目链接:http://codeforces.com/problemset/problem/459/A A. Pashmak and Garden time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pashmak has fallen in love with an attractive girl called Parmida s…
C. Anton and Making Potions 题目连接: http://codeforces.com/contest/734/problem/C Description Anton is playing a very interesting computer game, but now he is stuck at one of the levels. To pass to the next level he has to prepare n potions. Anton has a…
D. Alyona and a tree Problem Description: Alyona has a tree with n vertices. The root of the tree is the vertex 1. In each vertex Alyona wrote an positive integer, in the vertex i she wrote ai. Moreover, the girl wrote a positive integer to every edg…
E. George and Cards   George is a cat, so he loves playing very much. Vitaly put n cards in a row in front of George. Each card has one integer written on it. All cards had distinct numbers written on them. Let's number the cards from the left to the…
题目链接: http://codeforces.com/contest/740/problem/D D. Alyona and a tree time limit per test2 secondsmemory limit per test256 megabytes 问题描述 Alyona has a tree with n vertices. The root of the tree is the vertex 1. In each vertex Alyona wrote an positiv…
题目链接: 题目 B. Chip 'n Dale Rescue Rangers time limit per test:1 second memory limit per test:256 megabytes 问题描述 A team of furry rescue rangers was sitting idle in their hollow tree when suddenly they received a signal of distress. In a few moments they…
B. Approximating a Constant Range Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/602/problem/B Description When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowl…
D. Chip 'n Dale Rescue Rangers Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/591/problem/D Description A team of furry rescue rangers was sitting idle in their hollow tree when suddenly they received a signal of distress.…
[题目链接] http://codeforces.com/problemset/problem/700/A [题目大意] 有一辆限载k人速度为v2的车,n个步行速度均为v1的人要通过一段长度为l的距离,每个人只能上车一次,车可以来回走,问所有人到达目的地所需要的最短时间是多少 [题解] 因为车可以载k个人,所以,我们把人k个为一组分成(n+k-1)/k组,记为p吗,设需要的最短时间为t,每个人在车上待的时间为t2,那么可以列方程v1*(t-t2)+v2*t2=l,我们可以发现t2可以用t来表示,…
D. Game with modulo time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output This is an interactive problem. Vasya and Petya are going to play the following game: Petya has some positive integer num…
n people are standing on a coordinate axis in points with positive integer coordinates strictly less than 106. For each person we know in which direction (left or right) he is facing, and his maximum speed. You can put a bomb in some point with non-n…
B. Case of Fugitive time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Andrewid the Android is a galaxy-famous detective. He is now chasing a criminal hiding on the planet Oxa-5, the planet a…
A. Sagheer and Crossroads time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Sagheer is walking in the street when he comes to an intersection of two roads. Each road can be represented as two…
[题目链接]:http://codeforces.com/contest/822/problem/C [题意] 有n个旅行计划, 每个旅行计划以开始日期li,结束日期ri,以及花费金钱costi描述; 让你在这n个旅行计划中选出两个计划; 要求这两个计划的日期没有相交的部分; 且这两个日期的总时间长度恰好为x; 让你求最小花费 [题解] 先把每个计划按照左端点第一优先级,右端点第二优先级升序排序; 然后定义一个dp[x]数组,表示在前i个计划中,时长为x,且右端点的位置< a[i].l的一个旅行…
题目意思大概是给你w,m,k三个数,让你从m开始找 m m+1 m+2 m+3...........m+m', 使得他们的权值之和不超过w,计算权值的方法如下S(n)·k . S(n)表示n有多少位数,让你计算出最多有多少个这样的数. 乍一眼看去,10^16如此大的数肯定不能暴力,然后稍微思考一下就可以找到规律了,规律如下. 1-10              有9个一位数 1-100            有9个一位数 有90个二位数 1-1000          有9个一位数 有90个二位…
cf1020D 题意: 交互题目,在有限的询问中找到一个x,使得数列中的第x位和第(x+n/2)位的值大小相同.数列保证相邻的两个差值为1或-1: 思路: 构造函数f(x) = a[x] - a[x + n/2] ,由于a数列差值为1或-1,所以可以发现f(x)是连续的.然后就可以用二分了,这种二分的check方式是自己第一次见的.就是通过f(mid)和f(d)的正负来判断区间的移动.其中d是任选的. 代码: #include <iostream> #include <cstdio>…
A Tale of Two Lands 题目链接(点击) The legend of the foundation of Vectorland talks of two integers xx and yy. Centuries ago, the array king placed two markers at points |x||x| and |y||y| on the number line and conquered all the land in between (including…
题意:有\(n\)个数,每次可以选\(k(1\le k\le n)\)个数,并且得到\(a_1+max(0,a_2-1)+max(0,a_3-2)+...+max(0,a_k-k+1)\)的贡献,问最少选多少次使得总贡献不小于\(m\). 题解:我们从大到小排序,然后二分答案,贪心,如果答案是\(k\)天,那么对于前\(k\)个数,我们一定单独选它们分配到不同的\(k\)个集合中,然后再重复这个过程,从\(k+1\)个数开始循环分配到不同j集合中,这样一定能得到最大的贡献. 代码: ll n,m…
题意:有\(n\)个话题,每次都必须选取不同的话题,且话题数必须是上次的两倍,第一次的话题数可以任意,问最多能选取多少话题数. 题解:我们首先用桶来记录不同话题的数量,因为只要求话题的数量,与话题是多少无关,所以我们可以开个新数组然后离散化一下,比如\(mp[5]=6\)可以离散化成\(disc[1]=6\),\(mp[7]=2\)可以离散化成\(disc[2]=2\),这样可以方便我们进行二分查找,然后我们对\(disc\)数组sort一下,从\([1,n]\)开始进行二分,每次去找\(pos…
The link to problem:Problem - D - Codeforces   D. Range and Partition  time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output Given an array a of n integers, find a range of values [x,y] (x≤y…
Codeforces Round #510 (Div. 2) https://codeforces.com/contest/1042 A 二分 #include<iostream> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define sqr(x) ((x)*(x)) #define pb push_back #define eb emplace_back #…
本文章转载:http://www.cnblogs.com/zengxiangzhan/archive/2011/01/16/1936938.html 在vs2010中,用JQuery ajax调用asp.net 2.0的 webMethod 方法时,怎么都调不出来,原来和3.5 有点出入. 3.5中,无需特殊设置,可以直接用$.ajax调用在aspx.cs中,访问级别public,静态的,标记为[webmethod]的方法. aspx.cs: using System.Web.Services;…
插件说明 - jBox 是一款基于 jQuery 的多功能对话框插件,能够实现网站的整体风格效果,给用户一个新的视觉享受. 运行环境 - 兼容 IE6+.Firefox.Chrome.Safari.Opera 等主流浏览器.备注:IE不支持边框的圆角样式,不推荐大家使用蛋痛的IE浏览器. 使用授权 - jBox 永久免费使用,但是必须保留相关的版权信息.如果有好的建议,请Email: kudychen@gmail.com,jBox的完善需要大家的好建议. 使用方法 <script type=&quo…
摘要: 最近项目中有一个特殊的需求,下拉选择部门,但是部门的层级关系要在下来框中体现出来,如下图 下面我就把实现的过程分享给大家,代码如下: dropdowntreeview.js /* * * DropDownTreeView * https://github.com/jsExtensions/kendoui-extended-api * */ var DropDownTreeView = kendo.ui.Widget.extend({ _uid: null, _treeview: null…