Special subset sums: meta-testing Let S(A) represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: S(B) ≠ S(C); that is, sums of subse…
Special subset sums: optimum Let S(A) represent the sum of elements in set A of size n. We shall call it a special sum set if for any two non-empty disjoint subsets, B and C, the following properties are true: S(B) ≠ S(C); that is, sums of subsets ca…
题目描述: C. Producing Snow time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Alice likes snow a lot! Unfortunately, this year's winter is already over, and she can't expect to have any more of i…
题目链接:http://codeforces.com/problemset/problem/476/C 题目意思:给出两个数:a 和 b,要求算出 (x/b) / (x%b) == k,其中 k 的取值范围是 [1, a],找出满足所有正整数的 x 并求出所有 x 的和. 是不是觉得无从下手呢?我当时也是 = = .....看了整晚题解,算是看懂了... 首先设 d = x / b, m = x % b,那么整条式子就变成 d/m = k —> d = mk(1) (好快你就知道有啥用了…
Planning time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today,…
You are given a set Y of n distinct positive integers y1, y2, ..., yn. Set X of n distinct positive integers x1, x2, ..., xn is said to generate set Y if one can transform X to Y by applying some number of the following two operation to integers in X…
Dreamoon is standing at the position 0 on a number line. Drazil is sending a list of commands through Wi-Fi to Dreamoon's smartphone and Dreamoon follows them. Each command is one of the following two types: Go 1 unit towards the positive direction,…
Level: Medium 题目描述: Given a set of distinct integers, nums, return all possible subsets (the power set). Note: The solution set must not contain duplicate subsets. Example: Input: nums = [1,2,3] Output: [ [3], [1], [2], [1,2,3], [1,3], [2,3], [1,2]…
C. Heap Operations time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Petya has recently learned data structure named "Binary heap". The heap he is now operating with allows the following…
N次操作 I是插入一个数 Q是输出第K大的数 Sample Input8 3 //n kI 1I 2I 3QI 5QI 4Q Sample Output123 # include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include <string> # include <cmath> # include <queue&…
一 题面 D. N Problems During K Days 二 分析 对于这题,刚开始我就是陷入了对公式的执着,企图用公式直接确定第一个数,然后试着去找序列.经过思考和手动模拟后发现是很难保证正确性的. 对于这题,第一步是很明确的,就是确定第一个数,如果给定了$N$和$K$,那么第一个数是可以确定的.因为如果我们只保证后一个数比当前数多1,并且确定第一个数是1,那么可以根据$K$确定对应的最小和$sum$ $sum = \frac{K(K+1)}{2}$ 这个公式应该比较基础.这样我们就可…
Description It’s an interesting experience to move from ICPC to work, end my college life and start a brand new journey in company. As is known to all, every stuff in a company has a title, everyone except the boss has a direct leader, and all the re…