B. Tennis Game time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Petya and Gena love playing table tennis. A single match is played according to the following rules: a match consists of mult…
题目链接: B. Skills time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Lesha plays the recently published new version of the legendary game hacknet. In this version character skill mechanism was…
题意:网球有一方赢t球算一场,先赢s场的获胜.数列arr(长度为n)记录了每场的胜利者,问可能的t和s. 首先,合法的场景必须: 1两方赢的场数不一样多. 2赢多的一方最后一场必须赢. 3最后一场必须打满(即胜利者赢了t球) 首先要两个sum数组记录arr前i个元素中有多少个1,多少个2.先枚举t(从1-n),当前位置从cur=1开始,要查cur到多少(记为pos1),有t个1,到多少(pos2),有t个2.这个在sum数组里用lower_bound查.让cur=(pos1,pos2中小的那个)…
题目描述: Maximum Value time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a sequence a consisting of n integers. Find the maximum possible value of (integer remainder of *a**i* divi…
Yukari's Birthday  HDU4430 就是枚举+二分: 注意处理怎样判断溢出...(因为题目只要10^12) 先前还以为要用到快速幂和等比数列的快速求和(但肯定会超__int64) 而且这样判断会超时的... 还有题目中的And it's optional to place at most one candle at the center of the cake. (中间的蜡烛可有可无) 还有观察数据就知道:因为n最大10^12,r最多枚举到40,然后二分k的结果,看是否有符合条…
1514: Packs Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 61  Solved: 4[Submit][Status][Web Board] Description Give you n packs, each of it has a value v and a weight w. Now you should find some packs, and the total of these value is max, total of…
The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x C x D are such that a + b + c + d = 0 . In the following, we assume that all lists have the same size n .…
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…
传送: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]的第二类咒语.注…