[Codeforces 1013B] And】的更多相关文章

[题目链接] http://codeforces.com/problemset/problem/1013/B [算法] 不难发现,答案只有0,1,2,-1,共4种取值 分类讨论即可,计算时可以使用STL-map [代码] #include<bits/stdc++.h> using namespace std; #define MAXN 100010 int i,n,x; int a[MAXN]; map<int,int> mp; int main() { scanf("%…
题目链接: https://vjudge.net/problem/1735275/origin 基本思路: 本题思路比较简单,首先,我们知道 a & x = b, b & x = b; 所以,一个数通过与运算改变只能改变一次! 所以,这里就有一种暴力的写法,三次for循环,时间复杂度是O(3n). 第一次,从1到n遍历一遍,计算各个元素出现的次数,如果大于等于2,则输出0,结束. 第二次,从1到n遍历,如果存在 vis[ a[i]&k ] >= 2 并且 与k与运算后的值与之…
题目链接:戳这里 转自:参考博客 题意:给一个n*m的矩阵,放入q个点,这q个点之间的关系是,若已知这样三个点(x1,y1),(x2,y1),(x1,y2),可以在(x2,y2)处生成一个新的点,对于新的点和被使用过的点都能重复使用,问你最少需要在矩阵汇总添加多少个点是的整个矩阵被点铺满? 解题思路:通过画图可以发现我们对于一个N*M的空矩阵,我们最少填加n+m-1个点就能再通过题意给出的操作不断生成新的点铺满整个图.而且对于题目给出的操作,我们可以发现有这样的规律: 当插入点(x1,y1) 时…
CodeForces 1013B And CodeForces 1013C  Photo of The Sky B 可以发现只有一次与操作是有意义的,所以答案只有-1,0,1,2四种情况 #include <bits/stdc++.h> #define show(a) cout << #a << " = " << a << endl; ; ; ; typedef long long ll; using namespace st…
从这里开始 题目地址 瞎扯 Problem A Piles With Stones Problem B And Problem C Photo of The Sky Problem D Chemical table Problem E Hills Problem F AB-Strings 瞎扯 打比赛,发现自己越来越菜. 差点C题都不会了,怀疑人生... 发现自己C的贪心挂了两次然后D题不会怀疑不应来打这场比赛. 然后看到E.出题人的仁慈啊..终于不考智商了.提高组的送分dp(好吧,应该是省选里…
上一次我们拿学校的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…