ACM-ICPC 2017 Asia Urumqi G. The Mountain】的更多相关文章

All as we know, a mountain is a large landform that stretches above the surrounding land in a limited area. If we as the tourists take a picture of a distant mountain and print it out, the image on the surface of paper will be in the shape of a parti…
I. Older Brother Your older brother is an amateur mathematician with lots of experience. However, his memory is very bad. He recently got interested in linear algebra over finite fields, but he does not remember exactly which finite fields exist. For…
L. Sticky Situation While on summer camp, you are playing a game of hide-and-seek in the forest. You need to designate a “safe zone”, where, if the players manage to sneak there without being detected,they beat the seeker. It is therefore of utmost i…
Alice and Bob are playing a simple game. They line up a row of n identical coins, all with the heads facing down onto the table and the tails upward. For exactly mm times they select any k of the coins and toss them into the air, replacing each of th…
Alice and Bob are playing a simple game. They line up a row of nn identical coins, all with the heads facing down onto the table and the tails upward. For exactly mm times they select any kk of the coins and toss them into the air, replacing each of…
A. Coins Alice and Bob are playing a simple game. They line up a row of nnn identical coins, all with the heads facing down onto the table and the tails upward. For exactly mmm times they select any kkk of the coins and toss them into the air, replac…
0.起因 有时.DFS总是比BFS受人喜爱--毕竟DFS简单粗暴,更,而有些东西BFS不要启动,DFS它似乎是一个可行的选择-- 但是有一个问题,DFS默认直接写入到系统堆栈.系统堆栈和足够浅,此时OI传统的方法是通过手工叠写,acm究一下旁门左道--开栈外挂. Uva上的神贴(Set heap size and stack size in C++,http://acm.uva.es/board/viewtopic.php?f=14&t=16685)里面提到了一个拓栈外挂: #include &l…
挺不错的概率DP,看似基础,实则很考验扎实的功底 这题很明显是个DP,为什么???找规律或者算组合数这种概率,N不可能给的这么友善... 因为DP一般都要在支持N^2操作嘛. 稍微理解一下,这DP[i][j]还是不好想啊,首先是写DP[I][j]的含义 首先我们想这道题是要求一个最优决策下的期望,那么这个我们的最优决策是什么??? 决策就是:我们假设我这一次需要翻转K个硬币,我们不愿翻那些已经在正面的,而去翻那些没有在正面的 而如果剩余的反面的不足,我再去翻转正面的 那么给dp[i][j]一个含…
题目链接:https://www.jisuanke.com/contest/2870?view=challenges 题目大意:给出n个都正面朝下的硬币,操作m次,每次都选取k枚硬币抛到空中,求操作m次后,硬币向上的期望值. 思路: 1.期望跟概率还是有点不同的,期望要枚举出抛的所有的情况,然后求sigma(i * dp[][]) 2.dp[i][j]表示进行i次操作后,有j枚硬币向上的概率.这样就可以求最后的硬币向上的期望了. 3.值得注意的是,预处理的组合数要开 double 型. 代码:…
https://open.kattis.com/problems/researchproductivityindex 这道题是考场上没写出来的一道题,今年看看感觉简单到不像话,当时自己对于dp没有什么概念,所以导致考场只能空流泪 首先问期望,肯定就要确定概率.看到这个 就知道肯定一块求是不太好写的,先求上面,上面求发表的期望,那么对于期望我们有e(x) = Σxipi 这里p知道了但是xi不知道,那么我们根据题目描述我们有一个分子一个分母,分子是发表的次数,分母是论文数,首先对于任何j篇论文发表…