Codeforces Round #142 (Div. 1) C. Triangles】的更多相关文章

Codeforces Round #142 (Div. 1) C. Triangles 题目链接 今天校内选拔赛出了这个题,没做出来....自己思维能力还不够强吧.我题也给读错了.. 每次拆掉一条边,可以考虑在原图中会破坏多少三角形,但这也不好统计:所以可以转化一下,在新图中是什么样子的. 原图中会破坏三角形的话,那么在新图中,那些没有被\(a,b\)两个点连接的点的个数就应当是破坏的个数.这个好统计,就是\(n-du[a]-du[b]+\)与\(a,b\)同时相连的点的数量.这个容斥一下就出来…
http://codeforces.com/contest/528/problem/E 先来吐槽一下,一直没机会进div 1, 马力不如当年, 这场题目都不是非常难,div 2 四道题都是水题! 题目大意:给n条直线,保证直线两两不平行,保证三条直线不公点.然后,随机挑三条直线,构成一个三角形,问挑出的三角形的面积的期望. 换句话说,就是算出全部三角形的面积和.再除以三角形的数量.后者是C(n,3), 关键是三角形面积和怎样计算. 下面给我我的思路:O(n^2) 基于三角形的向量表示法, S(A…
A. Dragons 按\(x\)排序. B. T-primes \(x\)是平方数,且根\(\sqrt{x}\)是个质数. C. Shifts 枚举列的位置,对于每行来说,最多只会涉及4个列. D. Planets 最短路. E. Triangles 3个点可以分成4种情形:0条边,1条边,2条边,3条边. 考虑计数0和3,或1和2. 1和2至少有一条边,记与\(u\)有连边的点数为\(d_u\),则没有连边的点为\(n-1-d_u\),则\(d_u\cdot(n-1-d_u)\)构成的方案要…
B. T-primes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output We know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a posit…
Pythagorean Triples 题目链接: http://codeforces.com/contest/707/problem/C Description Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such th…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输出”#Color”,如果只有”G”,”B”,”W”就输出”#Black&White”. #include <cstdio> #include <cstring> using namespace std; const int maxn = 200; const int INF =…
 cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....       其实这个应该是昨天就写完的,不过没时间了,就留到了今天.. 地址:http://codeforces.com/contest/651/problem/A A. Joysticks time limit per test 1 second memory limit per test 256…
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/output 1 s, 256 MB  x2377 B Queue standard input/output 2 s, 256 MB  x1250 C Hacking Cypher standard input/output 1 s, 256 MB  x740 D Chocolate standard in…