[CF 471C] MUH and House of Cards】的更多相关文章

C. MUH and House of Cards   Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev decided to build a house of cards. For that they've already found a hefty deck of n playing cards. Let's describe the…
MUH and House of Cards Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 471C Description Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo o…
题目链接:http://codeforces.com/problemset/problem/471/C 题目意思:有 n 张卡,问能做成多少种不同楼层(floor)的 house,注意这 n 张卡都要用光.每层 floor 都由一定的 room 构成,每两个相邻 room 规定要有一个公共的ceiling.规定从上到下看,每层 floor 的 room 的数量呈递增的形式排布. 好容易想到构成最高层时用的最少数量的card需要多少.可以发现,每层的需要用到的card 可以用这个表达式表示: 3n…
1. CF 438D The Child and Sequence 大意: n元素序列, m个操作: 1,询问区间和. 2,区间对m取模. 3,单点修改 维护最大值, 取模时暴力对所有>m的数取模. 因为取模后至少减半, 复杂度$O(nlognlogC)$ 2. CF 431E Chemistry Experiment 大意: n个试管, 第$i$个试管有$a_i$单位水银, m个操作: 1, 修改$a_x$改为$v$. 2, 将$v$单位水倒入试管, 求一种方案使得有水的试管水银与水总量的最大…
题目链接: 传送门 Little Elephant and Cards time limit per test:2 second     memory limit per test:256 megabytes Description The Little Elephant loves to play with color cards. He has n cards, each has exactly two colors (the color of the front side and the…
Soldier and Cards time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Two bored soldiers are playing card war. Their card deck consists of exactly n cards, numbered from 1 to n, all values are…
题目链接:C. Soldier and Cards Two bored soldiers are playing card war. Their card deck consists of exactly n cards, numbered from 1 to n, all values are different. They divide cards between them in some manner, it's possible that they have different numb…
题意:给你一个只有‘.’和'#'的n*n的格子,问所有的'#'是不是只属于一个十字叉,如果不是输出NO,否则输出YES. #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int n; ][]; ][]; int main() { scanf("%d",&n); ; i<=n; i++) { scanf("%s"…
http://codeforces.com/contest/387/problem/E 题意:给你n个数,然后在输入k个数,这k个数都在n个数中出现,进行每一次操作就是在n个数中选择长度为w的连续序列,然后删除这w个数中的最小的一个,然后你就会的到w个奖励,如何获得最多奖励? 思路:set+数状数组,数状数组用来记录在每一个连续的区间内数的个数,用来记录删除和添加数的个数,先对a数组中的数记录每一个数在序列中的位置,再对b数组进行标记,然后遍历1-n,被标记数,把它的位置放在set里面,没有被标…
\(\mathcal{Description}\)   Link.   打乱的 \(n\) 张编号 \(1\sim n\) 的数字排和 \(m\) 张鬼牌.随机抽牌,若抽到数字,将数字加入集合 \(S\):否则,还原牌堆(但不清空 \(S\)).若 \(S=[1,n]\) 且抽到鬼牌时结束抽牌.求期望抽牌次数.   \(n,m\le2\times10^6\). \(\mathcal{Solution}\)   称从初始牌堆开始抽牌一直到抽到鬼牌为一轮操作,发现结束时必然抽了若干个完整的轮且不能中…