Codeforces Round #326 (Div. 2) B】的更多相关文章

D. Duff in Beach Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/588/problem/D Description While Duff was resting in the beach, she accidentally found a strange array b0, b1, ..., bl - 1 consisting of l positive integers. Th…
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…
B. Duff in Love Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/588/problem/B Description Duff is in love with lovely numbers! A positive integer x is called lovely if and only if there is no such positive integer a > 1 such…
A. Duff and Meat Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/588/problem/A Description Duff is addicted to meat! Malek wants to keep her happy for n days. In order to be happy in i-th day, she needs to eat exactly aikilo…
http://codeforces.com/contest/588/problem/D 感觉吧,这道题让我做,我应该是不会做的... 题目大意:给出n,L,K.表示数组的长度为n,数组b的长度为L,定义数组b[i]=a[i%n].然后数组b的最长的lis为k,问能有几组<=k的lis 条件如下: ①序列长度>=1并且<=k ②序列在每一块长度为n的数组中只能选择一个数,且选择的必须是连续的块 ③序列是不严格的单调递增 思路:主要是看这个人的http://m.blog.csdn.net/a…
1.每一个合数都可以由若干个素数相乘而得到 2.质因数知识 :求一个数因数的个数等于它的每个质因数的次数加一的和相乘的积因为质因数可以不用,所以要加一.例如6=2x3,两个质因数都是一次,如果两个质因数都不用,它的一个因数是1:只用因数2,它的第二个因数就是2:只用因数3,它的第三个因数就是3:两个质因数都用,它的第四个因数就是6. 所以6的因数的个数就是(1+1)(1+1)=4.再如12=2²x3,两个质因数,2是2次,3是一次,如果两个质因数都不用,它的一个因数是1:只用一个因数2,它的第二…
题意(CodeForces 588E) 给定一棵\(n\)个点的树,给定\(m\)个人(\(m\le n\))在哪个点上的信息,每个点可以有任意个人:然后给\(q\)个询问,每次问\(u\)到\(v\)上的路径有的点上编号最小的\(k(k \le 10)\)个人(没有那么多人就该有多少人输出多少人). 分析 \(u\)到\(v\)上路径的询问很显然的想到LCA,但是要维护前\(k\)个在路径上的最小的点似乎是个有点麻烦的问题.其实,找到了LCA(设为\(p\)点),我们就可以同样的利用倍增的思想…
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, …
题意: 一个数x被定义为lovely number需要满足这样的条件:不存在一个数a(a>1),使得a的完全平方是x的因子(即x % a2  != 0). 给你一个数n,求出n的因子中为lovely number的最大因子. 思路: 由于1<=n<=0=109,所以我们只要从1到找sqrt(n)就好,然后先从最大因子开始判断是否满足lovely number的条件,当满足时直接出输出即可. 代码如下: #include <iostream> #include <cstd…
题意: Duff每天要吃ai千克肉,这天肉的价格为pi(这天可以买好多好多肉),现在给你一个数值n为Duff吃肉的天数,求出用最少的钱满足Duff的条件. 思路: 只要判断相邻两天中,今天的总花费 = ai*pi 与昨天的总花费(还有加上今天要吃的肉的重量)= (ai-1 + ai)*pi-1 . 代码如下: #include <iostream> #include <cstdio> #include <cstring> #include <fstream>…