Codeforces#277 C,E】的更多相关文章

题目大意: 求一个 n*n的 (0,1)矩阵,每行每列都只有两个1 的方案数 且该矩阵的前m行已知 分析: 这个题跟牡丹江区域赛的D题有些类似,都是有关矩阵的行列的覆盖问题 牡丹江D是求概率,这个题是方案数,也比较相似.. 这种题中,因为只要求方案数..我们只要关注几行几列有几个1,而不必要关注具体的位置 题解: 行列都需要处理,因此考虑记录列的状态,然后一行一行的转移 最暴力的方程: dp[i][j][k][t] 表示已经确定了 i 行 有 j列已经有两个1,有k列只有一个1,有t列一个1也没…
C. Palindrome Transformation time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Nam is playing with a string on his computer. The string consists of n lowercase English letters. It is meaningl…
C. Given Length and Sum of Digits... time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have a positive integer m and a non-negative integer s. Your task is to find the smallest and the la…
n个人,每个人会一些语言,两个人只要有会一门相同的语言就可以交流,问为了让这n个人都交流,至少还得学多少门语言 先根据n个人之间他们会的语言,建边 再dfs找出有多少个联通块ans,再加ans-1条边就可以让他们连通 注意特判一下每个人都会0门语言的情况 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<vector> using…
Codeforces Round #277 (Div. 2) A. Calculating Function time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output For a positive integer n let's define a function f: f(n) =  - 1 + 2 - 3 + .. + ( - 1)n…
题目传送门 /* 贪心+构造:因为是对称的,可以全都左一半考虑,过程很简单,但是能想到就很难了 */ /************************************************ Author :Running_Time Created Time :2015-8-3 9:14:02 File Name :B.cpp *************************************************/ #include <cstdio> #include &…
门户:Codeforces Round #277 (Div. 2) 486A. Calculating Function 裸公式= = #include <cstdio> #include <cstring> #include <algorithm> using namespace std ; typedef long long LL ; LL n ; int main () { while ( ~scanf ( "%I64d" , &n )…
http://codeforces.com/contest/489 Problems     # Name     A SwapSort standard input/output 1 s, 256 MB    x2668 B BerSU Ball standard input/output 1 s, 256 MB    x2659 C Given Length and Sum of Digits... standard input/output 1 s, 256 MB    x2261 D U…
题目链接:http://codeforces.com/contest/489 A:SwapSort In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order. Swaps…
E. LIS of Sequence Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/486/problem/E Description The next "Data Structures and Algorithms" lesson will be about Longest Increasing Subsequence (LIS for short) of a sequence.…