传送: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…
E. Simple Skewness time limit per test:3 seconds memory limit per test:256 megabytes input:standard input output:standard output Define the simple skewness of a collection of numbers to be the collection's mean minus its median. You are given a list…
题目描述: 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…
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…
<题目链接> 题目大意: 给定起点和终点,某艘船想从起点走到终点,但是海面上会周期性的刮风,船在任何时候都能够向四个方向走,或者选择不走,船的真正行走路线是船的行走和风的走向叠加的,求船从起点到终点的最小步数. 解题分析: 因为本题数据量十分大,并且船和风叠加的行走路线比较复杂,所以我们考虑用二分答案解题.因为从起点到终点的有效步数是一定的,所以我们可以将船走动的总步数与风的步数(风吹不动的船的步数)分别进行计算,因为风是周期性吹的,但是从起点走到终点不一定是整数个周期,所以我们需要记录每个周…
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的结果,看是否有符合条…
Sumsets Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11946   Accepted: 3299 Description Given S, a set of integers, find the largest d such that a + b + c = d where a, b, c, and d are distinct elements of S. Input Several S, each cons…
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…
题目描述: 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…