CodeForces 486B】的更多相关文章

题目链接:http://codeforces.com/problemset/problem/486/B 题目意思:给出一个m行n列的矩阵B(每个元素只由0/1组成),问是否可以利用矩阵B,通过一定的运算逆回来求出矩阵A(行和列数都跟B相同).可以的话输出"YES" 并输出矩阵A,否则输出 "NO".运算如下: 也就是,Bij 是通过 A 矩阵第 i 行中所有的数做 或(|) 运算接着再跟所有第 j 列中所有的数做 或 运算求出来的.or 运算就是除了所有元素都为 0…
矩阵的 OR ,也是醉了. 题目意思很简单,就是问你有没有这么一个矩阵,可以变化,得到输入的矩阵. 要求是这个矩阵每行都可以上下任意移动,每列都可以左右任意移动. 解题方法: 1.也是导致我WA 的原因,首先要判断是否是一个零矩阵,如果是一个零矩阵,那么YES输出 2.判断输入矩阵存在1的那个位置,在输出矩阵的同一行同一列是否存在1,如果没有则NO输出 3.开辟数组X[MAXN],Y[MAXN]记录这一行或者这一列是否有0这个元素 //#pragma comment(linker, "/STAC…
Let's define logical OR as an operation on two logical values (i. e. values that belong to the set {0, 1}) that is equal to 1 if either or both of the logical values is set to 1, otherwise it is 0. We can define logical OR of three or more logical va…
门户: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 )…
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题.. 今天,我们来扒一下cf的题面! PS:本代码不是我原创 1. 必要的分析 1.1 页面的获取 一般情况CF的每一个 contest 是这样的: 对应的URL是:http://codeforces.com/contest/xxx 还有一个Complete problemset页面,它是这样的:…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's…
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters. There is…
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概率是在正面,各个卡牌独立.求把所有卡牌来玩Nim游戏,先手必胜的概率. (⊙o⊙)-由于本人只会在word文档里写公式,所以本博客是图片格式的. Code #include <cstdio> #include <cstring> #include <algorithm> u…
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连通图)且这颗树中必须包含节点1 然后将这颗子树中的所有点的点权+1或-1 求把所有点权全部变为0的最小次数(n<=10^5) 题解: 因为每一次的子树中都必须有1,所以我们得知每一次变换的话1的权值都会变化 所以我们以1为根 现在,我们发现,如果一个节点的权值发生变化,那么他的父节点的权值一定发生变…