2017福建省赛 FZU 2278 YYS 数学 大数】的更多相关文章

Yinyangshi is a famous RPG game on mobile phones. Kim enjoys collecting cards in this game. Suppose there are n kinds of cards. If you want to get a new card, you need to pay W coins to draw a card. Each time you can only draw one card, all the cards…
1.FZU2272 Frog 传送门:http://acm.fzu.edu.cn/problem.php?pid=2272 题意:鸡兔同笼通解 题解:解一个方程组直接输出就行 代码如下: #include <map> #include <set> #include <cmath> #include <ctime> #include <stack> #include <queue> #include <cstdio> #in…
http://acm.fzu.edu.cn/problem.php?pid=2271 [题意] 给定一个n个点和m条边的无向连通图,问最多可以删去多少条边,使得每两个点之间的距离(最短路长度)不变. [思路] 首先对于多重边可以只保留最短的边,剩下的都删去 跑一次Floyd,用vis数组记录哪些边可以被松弛(注意map[i][k]+map[k][j]==map[i][j]时,i-j这条边如果在原图,也可以被删去) 最后遍历一下所有的原图的边,可以被松弛的就可以被删去 [Accepted] #in…
Kim likes to play Tic-Tac-Toe. Given a current state, and now Kim is going to take his next move. Please tell Kim if he can win the game in next 2 moves if both player are clever enough. Here “next 2 moves” means Kim’s 2 move. (Kim move,opponent move…
题目链接: G - YYS FZU - 2278 题目大意: 我们现在想要收集到n个卡片,现在已知抽到每种卡片的概率为1/n,现在每隔(n-1)!天就可以进行一次抽奖,问收集齐所有卡片的期望天数. 具体思路: 第一天获得一张新的卡片的概率是n/n,第二天获得新的卡片的概率是(n-1)/n.然后来分析一波第二天的概率,(n-1)/n代表的是当从n-1张抽出除了第一张以外的,都是满足条件的.打个比方,如果是抽中的概率是3/5,那么也就是说 抽(5/3)张一定能中.那么第二天的期望类比,也就是第二天的…
Wannafly交流赛1_B_硬币[数学] 链接:https://www.nowcoder.com/acm/contest/69/B 来源:牛客网 题目描述 蜥蜴的生日快到了,就在这个月底! 今年,蜥蜴的快乐伙伴之一壁虎想要送好多个1元硬币来恶整蜥蜴. 壁虎身上目前有的硬币种类和数量如下: c1个1元硬币.c5个5元硬币.c10个10元硬币.c50个50元硬币. 壁虎觉得只送c1个1元硬币不够慷慨,想拿一些币值较大的硬币去换更多的1元硬币,于是跑去找一台自动贩卖机,靠着买东西找零来获得更多1元硬…
2017 湖南省赛 K Football Training Camp 题意: 在一次足球联合训练中一共有\(n\)支队伍相互进行了若干场比赛. 对于每场比赛,赢了的队伍得3分,输了的队伍不得分,如果为平局则两支队伍各得1分. 现在给出每只队伍的得分\(s_i\),问最少和最多进行了多少场比赛,不超过1000组数据 \(1<=n<=20\) \(0<=s_i<=200\) 思路: 比赛的时候脑子不清醒,被这个配对难住了,暴力往搜索方面想了想,肯定会TLE啦,就放弃了 现在清醒一点,胜…
Yinyangshi is a famous RPG game on mobile phones. Kim enjoys collecting cards in this game. Suppose there are n kinds of cards. If you want to get a new card, you need to pay W coins to draw a card. Each time you can only draw one card, all the cards…
题目链接:http://acm.fzu.edu.cn/problem.php?pid=2278 题目: 题意: 有n种卡牌,每种卡牌被抽到的概率为1/n,求收齐所有卡牌的天数的期望. 思路: 易推得公式为: 由于n的范围太大,直接求阶乘会爆,所以我们得用大数来求~ 代码实现如下: import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String arg…
#1584 : Bounce 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 For Argo, it is very interesting watching a circle bouncing in a rectangle. As shown in the figure below, the rectangle is divided into N×M grids, and the circle fits exactly one grid. The bouncing…