Duff and Weight Lifting - 587A】的更多相关文章

题目大意:某个人训练举重,他每次可以举起来2^wi的重量,不过这个人比较懒所以他想尽量减少训练的次数,如果所有的训练重量2^a1 +2^a2+....2^ak = 2^x,那么这些重量可以一次性训练(不需要连续),问他最少要训练几次才行. 分析: 已知 2^x+2^x = 2^(x+1),所以相同的是可以合并成下一个的,最后只需要判断,有多少个不能合成的即可. 代码如下: #include<iostream> #include<string.h> #include<stdio…
B. Pasha and PhonePasha has recently bought a new phone jPager and started adding his friends' phone numbers there. Each phone number consists of exactly n digits. Also Pasha has a number k and two sequences of length n / k (n is divisible by k) a1, …
C. Duff and Weight Lifting Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/588/problem/C Description Recently, Duff has been practicing weight lifting. As a hard practice, Malek gave her a task. He gave her a sequence of wei…
题意:一数列an,如果存在一个k,有2^(ai)+2^(aj)+......=2^k成立,那么一次能拿走ai,aj这些全部.问最少拿的次数. 太简单. 乱码 //#pragma comment(linker,"/STACK:1024000000,1024000000") #include<iostream> #include<cstdio> #include<string> #include<cstring> #include<ve…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 2^y可以由两个2^(y-1)相加得到. 则有一个贪心的策略. 就是2^x尽量都变成2^(x+1) (即能够凑就尽量凑) 如果x还有剩余的话.答案递增1 而凑上去的数字,显然是可以合并成1步操作的.因为他们的和就是2^(x+1) [代码] #include <bits/stdc++.h> #define ll long long using namespace std; const int N = 1e6; int n,a[N…
Baby Ming and Weight lifting Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 681    Accepted Submission(s): 280 Problem Description Baby Ming is fond of weight lifting. He has a barbell pole(the…
Problem Description Baby Ming is fond of weight lifting. He has a barbell pole(the weight of which can be ignored) and two different kinds of barbell disks(the weight of which are respectively a and b), the amount of each one being infinite.Baby Ming…
A.Duff and Weight Lifting(思维) 显然题目中只有一种情况可以合并 2^a+2^a=2^(a+1).我们把给出的mi排序一下,模拟合并操作即可. # include <cstdio> # include <cstring> # include <cstdlib> # include <iostream> # include <vector> # include <queue> # include <sta…
2021-10-14 P2577 [ZJOI2004]午餐 2021-10-13 CF815C Karen and Supermarket(小小紫题,可笑可笑) P6748 『MdOI R3』Fallen Lord(sort(a+1,a+1+n,greater<int>()); 真好用) P4161 [SCOI2009]游戏 P1707 刷题比赛 2021-10-12 CF1573A Countdown P2717 寒假作业 P7868 [COCI2015-2016#2] VUDU P1660…
/** * PHP实现文字写入图片 */class wordsOnImg { public $config = null; /** * @param $config 传入参数 * @param $config['file'] 图片文件 * @param $config['size'] 文字大小 * @param $config['angle'] 文字的水平角度 * @param $config['fontfile'] 字体文件路径 * @param $config['width'] 预先设置的宽…