Codeforces Round #181 (Div. 2)】的更多相关文章

C. Beautiful Numbers 题目连接: http://www.codeforces.com/contest/300/problem/C Description Vitaly is a very weird man. He's got two favorite digits a and b. Vitaly calls a positive integer good, if the decimal representation of this integer only contains…
B. Coach 题目连接: http://www.codeforces.com/contest/300/problem/A Description A programming coach has n students to teach. We know that n is divisible by 3. Let's assume that all students are numbered from 1 to n, inclusive. Before the university progra…
A. Array 题目连接: http://www.codeforces.com/contest/300/problem/A Description Vitaly has an array of n distinct integers. Vitaly wants to divide this array into three non-empty sets so as the following conditions hold: The product of all numbers in the…
用lucas定理, p必须是素数 对于单独的C(n, m) mod p,已知C(n, m) mod p = n!/(m!(n - m)!) mod p.显然除法取模,这里要用到m!(n-m)!的逆元. 根据费马小定理: 已知(a, p) = 1,则 ap-1 ≡ 1 (mod p),  所以 a*ap-2 ≡ 1 (mod p). 也就是 (m!(n-m)!)的逆元为 (m!(n-m)!)p-2 : 所以C(n, m) mod p = n! * (m! * (n - m)! )^(p-2)%mo…
A. Array 模拟. B. Coach 模拟. C. Beautiful Numbers good number的位和最大不超过\(10^7\),那么只要枚举a或b的个数,然后最多循环7次判断位和是否是good number. D. Painting Square 因为新划分的4个小矩形也需要为正方形,所以当前长度n必须为奇数,否则无法继续划分. \(f(i,j)\)表示长为\(2^i-1\),操作\(j\)次的方案数. 直接分成4部分比较难,所以可以先考虑分成左右两部分,左右两部分继续考虑…
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…