题意: 给你定义一堆变量,计算一下这些变量共占了多少k内存. 题解: 按题意模拟即可,善用ceil() // // Created by melon on 2019/10/22. // #include<bits/stdc++.h> using namespace std; #define ll long long #define dbg(x) cout<<#x<<"="<<x<<endl +],s1[+],s2[+]; in…
题目链接:https://nanti.jisuanke.com/t/31451 Given a rooted tree ( the root is node $1$ ) of $N$ nodes. Initially, each node has zero point. Then, you need to handle $Q$ operations. There're two types: 1 L X: Increase points by $X$ of all nodes whose dept…
http://codeforces.com/gym/101955/problem/G 给出一个6000*6000的坐标系,有四种操作,一是加入放置一个点到某个空格子上,二是从某个有点的格子移走一个点,三是将距离(x,y)距离为根号k的点权值加上w,四是询问距离(x,y)距离为根号k的点权值总和. 由于k都是整数,而在圆上的整数点很少,所以想到,A^2+B^2=K^2,处理出所有(A,B)对于每个A^2+B^2.1,2操作就很简单了,3,4操作的话直接暴力从K对应的(A,B)暴力查找合法的点. 各…
题目: 题意:给出一个序列a1,⋯,ana1,⋯,an.fac(l,r)fac(l,r)为mul(l,r)mul(l,r)中不同质因数的个数. 请计算:                 ∑i=1n∑j=infac(l,r) 思路:求质因数的贡献度,我们可以定义一个二维vector pos[i][k]=p表示当前质因数i在p位置出现k次那么该因子的贡献度为(n-p+1)*p,            因为可能会重复计算的,那么我们只要减去上一个位置出现i的情况,那么每一个质因子的贡献度为(n-pos…
题目链接:https://nanti.jisuanke.com/t/31447 "Oh, There is a bipartite graph.""Make it Fantastic." X wants to check whether a bipartite graph is a fantastic graph. He has two fantastic numbers, and he wants to let all the degrees to between…
题目链接:https://nanti.jisuanke.com/t/31452 A prime number (or a prime) is a natural number greater than $1$ that cannot be formed by multiplying two smaller natural numbers. Now lets define a number $N$ as the supreme number if and only if each number m…
哈密顿距离转切比雪夫距离,多种颜色跟两种颜色没有区别,记录最大最小次大次小即可. 圆求交点.…
题目链接:http://acm.zju.edu.cn/onlinejudge/showRuns.do?contestId=1 这题真的坑,为什么要买0本书的时候,书架里面刚好有价格为0的时候输出"Richman",难道不应该是"Impossible"吗??你肯定是要从头开始来一遍的,我觉得应该是不可能,,被这个题给卡住了... AC代码; #include<iostream> #include<string> #include<cstr…
C.Insertion Sort 题意:Q次询问,每次给出N,M,Mod,问你有多少种排列,满足前面M个数字排序之后整个序列的LIS>=N-1. 思路:我们把数字看成[1,M],[N-M+1,N]两个部分,假设是A和B.分几种情况即可. 我发现我好像想错了. https://blog.csdn.net/qq_23502651/article/details/84680151 另外:长度为N的排列的LIS为N-1的个数=(N-1)^2: 可以推出这个公式.F(i)=F(i-1)+i-1;  F(2…
E. Memory and Casinos 题目连接: http://codeforces.com/contest/712/problem/E Description There are n casinos lined in a row. If Memory plays at casino i, he has probability pi to win and move to the casino on the right (i + 1) or exit the row (if i = n),…