gym/102021/J GCPC18 模拟拼图】的更多相关文章

模拟拼图 题意: 给定n块拼图,每个拼图为四方形,对应四条边有四个数字,如果为0,表示这个边是在边界的,其他数字表示和另一个拼图的一条边相接.保证每个非零数只出现两次. 思路: 模拟,但是要注意几个情况,第一就是只有一行或一列的时候,对于0的判断,还有就是拼图的个数要和n相等. #include <algorithm> #include <iterator> #include <iostream> #include <cstring> #include &l…
gym/102021/K 题意: 给定n(n<=60)个直线 ,长度<=1000; 可以转化为取 计算 ans = (sum  + 10 - g) / ( n + 1)  在小于5的条件下的最大值,其中sum为任取n个的直线长度和,g是给定常数. 思路: 用类似背包的求法,把可能取到的结果用dp[i][j] = 1表示,其中i表示容量,j表示取了几个. #include <algorithm> #include <iterator> #include <iostr…
 2017 JUST Programming Contest 2.0 题目链接:Codeforces gym 101343 J.Husam and the Broken Present 2 J. Husam and the Broken Present 2 time limit per test:1.0 s memory limit per test:256 MB input:standard input output:standard output After you helped Husam…
http://codeforces.com/gym/100240 J [分析] 这题我搞了好久才搞出样例的11.76....[期望没学好 然后好不容易弄成分数形式.然后我‘+’没打..[于是爆0... 好桑心.. 对于x^2这样的期望,是不能直接求x的期望然后平方的! 为什么呢?因为意义就是不对的,你的概率有可能乘了两次什么的... 我的方法是: 先把每天分离出来,对于某一天,假设你前i部番的x^2的期望求了出来,然后新的一部翻在这天放的概率是p, 新的答案就是$x^{2}*(1-p)+p*(x…
Codeforces GYM 100876 J - Buying roads 题解 才不是因为有了图床来测试一下呢,哼( 题意 给你\(N\)个点,\(M\)条带权边的无向图,选出\(K\)条边,使得得到的子图联通并且总代价最小,输出最小总代价和一种方案. 虽然题目里描述的很冗长,但其实这个图有一些性质:它最初是一条链/一个环,然后再有一些结点直接连到这些在链上/环上的结点.. 下图就是一个(就是样例): 做法 首先我们可以简单的查看点的度数来找到链/环上的点,和连接它们的边. 然后我们可以通过…
Problem E. Easy ProblemsetInput file: easy.in Output file: easy.outPerhaps one of the hardest problems of any ACM ICPC contest is to create a problemset with a reasonable number of easy problems. On Not Easy European Regional Contest this problem is so…
J. Deck Shuffling Time Limit: 2   Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/J Description The world famous scientist Innokentiy continues his innovative experiments with decks of cards. Now he has a deck of n cards and k…
题目链接: http://codeforces.com/gym/100114 Description The computer network of “Plunder & Flee Inc.” consists of n servers and m two-way communication links. Two servers can communicate either through a direct link, or through a chain of links, by relayi…
Problem J. Bye Bye RussiaTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100500/attachments Description It was the last day at Russia, after the World Finals has ended. Coach fegla was travelling back to Cairo on the same day b…
J. Computer Network Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100114 Description The computer network of “Plunder & Flee Inc.” consists of n servers and m two-way communication links. Two servers can communicate either thr…