cf492B Vanya and Lanterns】的更多相关文章

B. Vanya and Lanterns time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vanya walks late at night along a straight street of length l, lit by n lanterns. Consider the coordinate system with t…
Codeforces  492B   B. Vanya and Lanterns 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=86640#problem/B 题目: Description Vanya walks late at night along a straight street of length l, lit by n lanterns. Consider the coordinate system with…
Description Vanya walks late at night along a straight street of length l, lit by n lanterns. Consider the coordinate system with the beginning of the street corresponding to the point 0, and its end corresponding to the point l. Then the i-th lanter…
题目链接:http://codeforces.com/problemset/problem/492/B #include <cstdio> #include <cstdlib> #include <iostream> #include <algorithm> #include <cstring> using namespace std; + ; double a[maxn]; double l[maxn], r[maxn]; int main()…
A. Vanya and Cubes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of…
A. Vanya and Cubes 题意: 给你n个小方块,现在要搭一个金字塔,金字塔的第i层需要 个小方块,问这n个方块最多搭几层金字塔. 分析: 根据求和公式,有,按照规律直接加就行,直到超过n. #include <cstdio> int main() { int n; scanf("%d", &n); , cnt = ; while(n > sum) { cnt++; sum += cnt * (cnt + ) / ; } if(sum > n…
A. Vanya and Cubes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of…
每个标题都做了题目原网址的超链接 Day1<Vanya and Lanterns> 题意: 一条长度为 l 的街道,在这条街道上放置了n个相同的灯,街道一端位置记为0,每个灯的位置在ai处,问灯的最小照射半径为多少时,才能满足整条街道都能被灯光照到 . 题解: 输入所有的灯的位置,然后进行排序. 比较每两个相邻的灯的距离,取最大值的 1/2. 比较两端的值:第一个灯需要照到 0 位置,最后一个灯需要照到 l 位置. 三个值中取最大值. 上板子: #include<bits/stdc++.…
Lanterns 题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=86640#problem/B 题目: Description Vanya walks late at night along a straight street of length l, lit by n lanterns. Consider the coordinate system with the beginning of the street corr…
C. Vanya and Scales Vanya has a scales for weighing loads and weights of masses w0, w1, w2, ..., w100 grams where w is some integer not less than 2(exactly one weight of each nominal value). Vanya wonders whether he can weight an item with mass m usi…