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.…
[链接]点击打开链接 [题意] 水题 [题解] 枚举b从x..y看看k*i是不是在l..r之间就好. [错的次数] 0 [反思] 在这了写反思 [代码] #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <vector> #include <map> #include <queue> #include…
[感谢牛老板对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…
·不论难度,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…
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…
题目链接: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…