题目描述: The Brand New Function time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Polycarpus has a sequence, consisting of n non-negative integers: a1, a2, ..., *a**n*. Let's define function f(…
A. The Brand New Function time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Polycarpus has a sequence, consisting of n non-negative integers: a1, a2, ..., an. Let's define function f(l, r) (…
转载请注明出处:http://blog.csdn.net/u012860063/article/details/37509207 题目链接:http://codeforces.com/contest/445/problem/C ----------------------------------------------------------------------------------------------------------------------------------------…
题目描述: Prime Gift time limit per test 3.5 seconds memory limit per test 256 megabytes input standard input output standard output Opposite to Grisha's nice behavior, Oleg, though he has an entire year at his disposal, didn't manage to learn how to sol…
M. Heaviside Function Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/M Description Heaviside function is defined as the piecewise constant function whose value is zero for negative argument and one for non-negat…
题目链接: D. Iterated Linear Function time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Consider a linear function f(x) = Ax + B. Let's define g(0)(x) = x and g(n)(x) = f(g(n - 1)(x)) for n > 0.…
D. Jerry's Protest time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Andrew and Jerry are playing a game with Harry as the scorekeeper. The game consists of three rounds. In each round, Andr…
D. Diverse Garland time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have a garland consisting of nn lamps. Each lamp is colored red, green or blue. The color of the ii-th lamp is sisi ('…
传送:http://codeforces.com/gym/101612 题意:给定一个数n(<=1e18),将n分解为若干个数的成绩.要求这些数两两之间的差值不能大于1. 分析: 若n==2^k,则答案一定是-1. 然后,考虑若n==a^k,枚举k,二分求a.若n==a^x*(a+1)^y,枚举x,y,二分求解a. 注意:两数相乘可能>1e18,特判. #include<bits/stdc++.h> using namespace std; typedef long long ll…
题目链接:http://codeforces.com/problemset/problem/734/C 题目大意:要制作n个药,初始制作一个药的时间为x,魔力值为s,有两类咒语,第一类周瑜有m种,每种咒语使制作一个药的时间变成a[i],花费b[i]的魔力,第二类咒语有k种,每种咒语瞬间产生c[i]个药,花费d[i]的魔力,c[i]和d[i]都是不递减的,求最短时间内产生n个药的时间.解题思路:因为c[i]和d[i]都是不降的,所以可以枚举a[i],然后二分查找花费小于t-b[i]的第二类咒语.注…