Codeforces 40E Number Table - 组合数学】的更多相关文章

题目传送门 传送门I 传送门II 题目大意 给定一个$n\times m$的网格,每个格子上要么填$1$,要么填$-1$,有$k$个位置上的数是已经填好的,其他位置都是空的.问有多少种填法使得任意一行或一列上的数的乘积为$-1$. $1 \leqslant n, m \leqslant 10^{3}$,$1 \leqslant k < \max (n, m)$. $k$的范围醒目.那么意味着至少存在一行或者一列为空. 假设空的是一行.那么剩下的行只需要满足那一行的乘积为$-1$,而空的这一行对应…
题目链接:Codeforces 417E Square Table 题目大意:给出n和m.要求给出一个矩阵,要求每一列每一行的元素的平方总和是一个平方数. 解题思路:构造.依照 a a a b a a a b a a a b c c c d 的方式取构造,然后a,b,c,d的值用随机生成数去枚举,只是我认为用暴力也是能够的. #include <cstdio> #include <cstring> #include <cmath> #include <cstdli…
题目链接:http://codeforces.com/problemset/problem/40/E 妙啊... 因为已经确定的格子数目严格小于了$max(n,m)$,所以至少有一行或者一列是空着的,那么除了这一行或者这一列的格子,其余的格子随意填,只要满足了当且对应的行(列)的积是$-1$就好了,用组合数算一算就好了,剩下的空着的一行或者一列用于收尾,可以发现它当且仅有一种放法. 考虑无解:如果$n+m$为奇数,同时还要注意一下如果$n=1$,或者$m=1$的情况 #include<iostr…
题目链接: B.Table 题意: \(n*m\)的矩阵使每个\(n*n\)矩阵里面准确包含\(k\)个点,问你有多少种放法. \((1 ≤ n ≤ 100; n ≤ m ≤ 10^{18}; 0 ≤ k ≤ n^2)\) 题解: - Let \(s_i\) number of points in the column \(i\). - Two neighboring squares are drawn at this picture, \(A\) is the number of point…
https://codeforces.com/problemset/problem/466/C 要把数据分为均等的非空的三组,那么每次确定第二个分割点的时候把(除此之外的)第一个分割点的数目加上就可以了.记得最后给第三组留至少一个. #include<bits/stdc++.h> using namespace std; #define ll long long int n; ]; int main(){ scanf("%d",&n); ;i<n;i++) s…
题目链接:https://codeforces.com/problemset/problem/1099/E You are given an $n×m$ table, consisting of characters «A», «G», «C», «T». Let's call a table nice, if every $2×2$ square contains all four distinct characters. Your task is to find a nice table (…
http://www.codeforces.com/gym/100827/attachments Hill Number Time Limits:  5000 MS   Memory Limits:  200000 KB 64-bit interger IO format:  %lld   Java class name:  Main Description A Hill Number is a number whose digits possibly rise and then possibl…
ZS the Coder and Chris the Baboon has explored Udayland for quite some time. They realize that it consists of n towns numbered from1 to n. There are n directed roads in the Udayland. i-th of them goes from town i to some other town ai (ai ≠ i). ZS th…
C. Table Decorations time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons.…
题目链接: E. Table Compression time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Little Petya is now fond of data compression algorithms. He has already studied gz, bz, zip algorithms and many o…