Codeforces Round #430 B. Gleb And Pizza】的更多相关文章

Gleb ordered pizza home. When the courier delivered the pizza, he was very upset, because several pieces of sausage lay on the crust, and he does not really like the crust. The pizza is a circle of radius r and center at the origin. Pizza consists of…
[感谢牛老板对D题的指点OTZ] codeforces 842 A. Kirill And The Game[暴力] 给定a的范围[l,r],b的范围[x,y],问是否存在a/b等于k.直接暴力判断即可. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> using namespace std; typede…
A. Kirill And The Game time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characteriz…
[链接]点击打开链接 [题意] 在这里写题意 [题解] 根据圆心到原点的距离这个东西判断一下圆在不在那个环里面就好 [错的次数] 0 [反思] 在这了写反思 [代码] #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <vector> #include <map> #include <queue> #…
http://codeforces.com/contest/842/problem/C 树 dp 一个数的质因数有限,用set存储,去重 #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <time.h> #include <string> #include <set> #include <map>…
http://codeforces.com/contest/842/problem/D 树 二进制(路径,每个节点代表一位) #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <time.h> #include <string> #include <set> #include <map> #incl…
地址:http://codeforces.com/contest/842/problem/C 题目: C. Ilya And The Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Ilya is very fond of graphs, especially trees. During his last trip…
A. Pizza Separation time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Students Vasya and Petya are studying at the BSU (Byteland State University). At one of the breaks they decided to order…
题目链接:http://codeforces.com/contest/842/problem/D 题意:定义Mex为一个序列中最小的未出现的正整数,给定一个长度为n的序列,然后有m个询问,每个询问给定一个数x,先对序列每个数与x进行异或运算(^),之后输出当前序列修改完之后的Mex. 思路:因为对于原序列和x异或后,得到的新序列再与y异或相当于原序列与z(z=x^y)进行异或,所以问题就可以转化为对于一个数val,原序列和val进行异或后得到新序列的Mex是多少? 考虑01字典树,先把序列的n个…
题目链接:http://codeforces.com/contest/842/problem/B 题意:给定一个圆心在原点(0,0)半径为r的大圆和一个圆内的圆环长度d,然后给你n个小圆,问你有多少个小圆完全位于圆环中 思路:求出每个小圆的圆心和原点的距离dist. 如果满足dist[i]-r[i]>=(r-d)&&dist[i]+r[i]<=r,说明这个小圆完全位于圆环. #define _CRT_SECURE_NO_DEPRECATE #include<iostrea…
题目链接:http://codeforces.com/contest/842/problem/A 题意:给定l,r,x,y,k.问是否存在a (l<=a<=r) 和b (x<=b<=y) 使得 a/b=k (a/b可能为浮点数). 思路:暴力枚举即可. #define _CRT_SECURE_NO_DEPRECATE #include<iostream> #include<cstring> #include<string> #include<…
因为抑或,一眼字典树 但是处理起来比较难 #include<iostream> #include<map> #include<iostream> #include<cstring> #include<cstdio> #include<set> #include<vector> #include<queue> #include<stack> #include<cmath> #include…
Ilya is very fond of graphs, especially trees. During his last trip to the forest Ilya found a very interesting tree rooted at vertex 1. There is an integer number written on each vertex of the tree; the number written on vertex i is equal to ai. Ily…
·不论难度,A,C,D自己都有收获! [A. Kirill And The Game] ·全是英文题,述大意:    给出两组区间端点:l,r,x,y和一个k.(都是正整数,保证区间不为空),询问是否在[x,y]区间内存在一个整数p,使得p*k属于[l,r],如果存在,则输出'YES',否则输出'NO'.(1<=l,r,x,y<=107) ·分析:     首先看见了107,发现可以直接O(n)暴力枚举:枚举区间[x,y]的所有数,判断它与k的乘积是否在[l,r]中就可以了.从容AC: #in…
Today at the lesson Vitya learned a very interesting function - mex. Mex of a sequence of numbers is the minimum non-negative number that is not present in the sequence as element. For example, mex([4, 33, 0, 1, 1, 5]) = 2 and mex([1, 2, 3]) = 0. Vit…
Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characterized by two integers - amount of experience and cost. The efficiency of a potion is the ratio of the amount of experience to the cost.…
D.Vitya and Strange Lesson(字典树) 题意: 给一个长度为\(n\)的非负整数序列,\(m\)次操作,每次先全局异或\(x\),再查询\(mex\) \(1<=n<=3e5\) \(0<=a_i<=3e5\) \(0<=x<=3e5\) 思路:求\(mex\)可以通过按从高位到低位建字典树,判断左子树是否满,若未满,贪心往走,否则往右走,这样查询是\(log\)的 现在就是异或修改,考虑x的第i位,若为1,则以第i-1层结点为根的左右子树都需要…
[链接]点击打开链接 [题意] 水题 [题解] 枚举b从x..y看看k*i是不是在l..r之间就好. [错的次数] 0 [反思] 在这了写反思 [代码] #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <vector> #include <map> #include <queue> #include…
[链接]点击打开链接 [题意] 给你一棵n个点的树,每个点的美丽值定义为根节点到这个点的路径上的所有权值的gcd. 现在,假设对于每一个点,在计算美丽值的时候,你可以将某一个点的权值置为0的话. 问你每个点的最大美丽值可能是多少. [题解] 从根节点开始进行dfs,在往下走的过程中,暴力用set记录下路径中把以上的每一个点删掉后的gcd是什么. 这set里的东西.进行扩展的时候,只能加入不删的点.因为它已经表示删掉一个点的状态了.下面只能都不删 了.然后用另外一个数组now,记录下到根节点到当前…
[链接]点击打开链接 [题意] 给出一个数组,每次操作将整个数组亦或一个数x,问得到的数组的结果中的mex.mex表示为自然数中第一个没有出现过的数. [题解] 异或的效果是可以累加的,所以不用每次都算出来每一次的a是什么.而只要把前i个询问的x取一下异或和now,然后用异或和对每个ai异或就可以了. 对于这道题.我们需要用字典树来做. 对于一开始的a数组中没有出现的数字,都把它按照位加入到字典树中,最多19位. 设原数组是a,然后没出现的数字组成数组A. 结论:则我们对原数组进行一次异或操作即…
B. Gleb And Pizza time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Gleb ordered pizza home. When the courier delivered the pizza, he was very upset, because several pieces of sausage lay on…
Codeforces Round #437 (Div. 2) codeforces 867 A. Between the Offices(水) 题意:已知白天所在地(晚上可能坐飞机飞往异地),问是否从西雅图飞到旧金山次数更多. 题解:只要判断第一天和最后一天状态即可. #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ; int n; char s[N]; int ma…
题目传送门 /* 构造:结构体排个序,写的有些啰嗦,主要想用用流,少些了判断条件WA好几次:( */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <vector> #include <map> #include <iostream> #include <string> using name…
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…
Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little beaver is a beginner programmer, so informatics is his favorite subject. Soon his info…
Codeforces Round #262 (Div. 2) 1004 D. Little Victor and Set time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Little Victor adores the sets theory. Let us remind you that a set is a group of…