E. Vus the Cossack and a Field (求一有规律矩形区域值) 题意:给出一个原01矩阵,它按照以下规则拓展:向右和下拓展一个相同大小的 0 1 分别和原矩阵对应位置相反的矩阵,向右下拓展一个和原矩阵相同的矩阵,可以无限拓展,现给出Q个查询 问以 x1,y1,x2,y2为矩阵左上角和右下角的矩形中共有多少个一 reference : https://blog.csdn.net/code92007/article/details/94149487 https://orzsi…
Description 给出一个$n\times m$的$01$矩阵$A$. 记矩阵$X$每一个元素取反以后的矩阵为$X'$,(每一个cell 都01倒置) 定义对$n \times m$的矩阵$A$进行一次变幻操作,变幻后矩阵的大小是$2n \times 2m$的. 具体来说,我们会把$A$复制一份到$A$的右下方,计算$A'$并放置在$A$的正右方和正下方. 设连续操作$n$的结果是$f^n(A)$ 即 $f^n(A) = \left\{\begin{matrix} f(f^{n-1}(A)…
题目描述: D. Vus the Cossack and Numbers Vus the Cossack has nn real numbers aiai. It is known that the sum of all numbers is equal to 00. He wants to choose a sequence bb the size of which is nn such that the sum of all numbers is 00 and each bibi is ei…
Vus the Cossack has two binary strings, that is, strings that consist only of "0" and "1". We call these strings aa and bb. It is known that |b|≤|a||b|≤|a|, that is, the length of bb is at most the length of aa. The Cossack considers e…
C. Vus the Cossack and Strings Vus the Cossack has two binary strings, that is, strings that consist only of "0" and "1". We call these strings aa and bb. It is known that |b|≤|a||b|≤|a|, that is, the length of bb is at most the length…
Vus the Cossack has nn real numbers aiai. It is known that the sum of all numbers is equal to 00. He wants to choose a sequence bb the size of which is nn such that the sum of all numbers is 00 and each bibi is either ⌊ai⌋⌊ai⌋ or ⌈ai⌉⌈ai⌉. In other w…
头文件:#include <math.h> atan2() 函数用于求 y / x 的反正切值.其原型为:    double atan2(double y, double x); [参数]x为坐标的X轴值,y为坐标的Y轴值.如果 x 和 y 的值都为 0,将会导致错误. atan2() 求坐标 x 和 y 的坐标的反正切值.反正切的角度值等于 X 轴与通过原点和给定坐标点的直线之间的夹角.结果以弧度表示,并介于 -π 到 π 之间. 在三角函数中,两个参数的函数 atan2() 是正切函数的…
求1-2+3-4+5---100 = ? 逻辑整理: -- 本质上可以转换一下,1+3+5+--+99 -(2+4+--+100) 加减部分间隔都为2,先求1+3+5+--+99的值, 再求2+4+--+100的值,减去结果就出来了 -- 还可以如此转换 1*[(-1)**(1+1)] +2*[(-1)**(1+2)]+--+100[(-1)**(1+100)] 通过-1来进行+ - 符号的转变  -- 最简单的方法是分开,1 – 2 = -1 ,3 – 4 = -1 , 依次下去,其实答案已经…
题意是给定一个椭圆标准方程的a,b(椭圆的长半轴长和短半轴长),在[0,b]内取一个数,则过点(0,b)且平行于x轴的直线与椭圆交于两点,再将此两点关于x轴做对称点,顺次连接此四点构成矩形,求出这些矩形周长的期望. 一开始的时候,想到所有矩形的周长和积分就是椭圆面积的两倍,但矩形的个数应该是 a + b,可是与样例不符......又尝试了矩形个数为a,b,π/2,均不对.再次读题,发现矩形的选择是在[0,b]中选的,那么矩形的个数就应该是b个. 依照题意,用积分的方法做,可得: 积分后得:a*b…
1,1,2,3,5,8,13,21,34,55.... 求第30位数的值: 递归方法: class Program { static void Main(string[] args) { //找规律: //1,1,2,3,5,8,13,21,34,55,...... ; Console.WriteLine(GetNum()); Console.ReadKey(); } /// <summary> /// 求第30位数的值 /// </summary> /// <param n…