SOJ 3531_Number Pyramids】的更多相关文章

[题意]给定一个数top及最底层元素个数n,构成一个以给top为塔尖,层数为n的如杨辉三角的金字塔,求有多少种 [分析]最终种数其实只与最底层的n个数的组合数有关,上层的每个都数是由最底层数相加得来 以层数4为例 设最底层 x1,x2,x3,x4 则第二层x1+x2,x2+x3,x3+x4 第三层x1+2*x2+x3, x2+2*x3+x4 最高层 x1+3*x2+3*x3+x4 可以看出  1 3 3 1  为 C(3,0) C(3,1) C(3,2) C(3,3) 所以问题可以看做是一个以…
-----------------------------最优化问题------------------------------------- ----------------------常规动态规划  SOJ1162 I-Keyboard  SOJ1685 Chopsticks SOJ1679 Gangsters SOJ2096 Maximum Submatrix  SOJ2111 littleken bg SOJ2142 Cow Exhibition  SOJ2505 The County…
SOJ 13983. Milk Scheduling 这是比赛题,还是作死的我最讨厌的英文题,题目大意就是有n头奶牛,要在喂奶截止时间前给他喂奶并得到相应的含量的牛奶. 一开始的想法就是挑选截止日期的最大产奶量的那头牛喂养,后来果不其然的WA了. 空闲的时间也可以给奶牛喂奶啥的....bug不要太多. 于是改来改去了,期间又WA了几发,总算是A掉了,但是代码也是要多搓有多搓,估计除了我自己没人看得懂. 所以后来选用了优先队列,STL的东西用顺手了还是蛮好用的.还用了pair类. 思路从截止日期最…
Archaeologists have discovered a new set of hidden caves in one of the Egyptian pyramids. The decryption of ancient hieroglyphs on the walls nearby showed that the caves structure is as follows. There are n caves in a pyramid, connected by narrow pas…
Exploring Pyramids Archaeologists have discovered a new set of hidden caves in one of the Egyptian pyramids. The decryption of ancient hieroglyphs on the walls nearby showed that the caves structure is as follows. There are n <tex2html_verbatim_mark>…
SOP SOP-EIAJ-TYPE-II-14L SSOP SSOP-16L TSOP(Thin Small Outline Package) TSSOP(Thin Shrink Outline Package) HSOP28 SOJ-32L SOJ…
题目链接 说实话挺喜欢soj的界面,简简单单,没有多余的东西hhh(但是简单到连内存限制,时间限制都看不到了. 题意是有个“奇葩”的主人公,吃饭要用三根筷子.两根短的一根长的. 现在给你n根筷子,要在里面挑k+8对筷子(一对三根,有一根最长的,设为Ai <= Bi <= Ci (Ai-Bi)^ 2 叫做 badness)使得 $\sum ^{k}_{i=1}\left( A_{i}-B_{i}\right) ^{2}$ 最小 emmmmm其实不放在dp分类里面我看不出是dp,以为是贪心(太菜了…
题目链接:[http://acm.scu.edu.cn/soj/problem.action?id=4552] 题意:给你n种卡牌,每种卡牌有无限多个,每次从中抽取一张卡牌,问:1.集齐这n种卡牌需要抽取次数的期望,2.抽取m次,刚好(要保证最后一抽牌刚好满足抽了n张不同的牌)集齐n张卡牌的概率. 数据范围:n<=15,m<=35;(尼玛,比赛的时候数据范围都不给清楚,只在discuss里面说了一下,还不通知). 题解:对于第一问:公式n*(1+1/2+1/3+....+1/n);第二问:dp…
Description Recently in Farland, a country in Asia, a famous scientist Mr. Log Archeo has discovered ancient pyramids. But unlike those in Egypt and Central America, they have triangular (not rectangular) foundation. That is, they are tetrahedrons in…
soj 131 找题 给出两个长度为n,都含k个1的字符串A,B.现在令\(a_1,a_2,\dots,a_k\)是A中1的下标,\(b_1,b_2,\dots,b_k\)是B中1的下表,然后将a,b等概率随机排列,接下来按1到k的顺序交换\(A_{a_i}\)与\(A_{b_i}\).令P为交换之后A与B相同的概率,求\(P*(k!)^2\)对\(998244353\)取模的结果.n<=10000. 本来以为只要随机排列b就行了,但是由于是顺序交换,所以要随机排列必须a和b都排列一下.那怎么办…