海上月是天上月,眼前人是心上人。
04 2022 档案
摘要:本文只是自己存的模板,来源于https://www.cnblogs.com/xenny/p/9801703.html; 想学习线段树的请前往大佬的博客。 #include<bits/stdc++.h> using namespace std; const int maxn=100005; int a
阅读全文
摘要:A. Red Versus Blue Team Red and Team Blue competed in a competitive FPS. Their match was streamed around the world. They played a series of nn matches
阅读全文
摘要:快速幂: long long fastPower(long long base, long long power) { long long result = 1; while (power > 0) { if (power & 1) { result = result * base % 1000;
阅读全文
摘要:1.埃氏筛 思路:将所求范围内所有的数定义为素数,从最小的真实素数(即2)开始,将其倍数筛选出来定义为非素数,最后剩下的被定义为素数的数便是给定范围内所有的素数。 代码: 1 #include<bits/stdc++.h> 2 using namespace std; 3 bool prime[10
阅读全文
摘要:1.按位与(&): 运算规则:只有两个数的二进制同时为1,结果才为1,否则为0。 即 0 & 0= 0 ,0 & 1= 0,1 & 0= 0, 1 & 1= 1。 两个整数在按位与运算时每一位分别进行运算,如3&5=011&101=001=1; 按位或(|): 2.运算规则:参加运算的两个数只要两个
阅读全文
摘要:A. GCD vs LCM You are given a positive integer nn. You have to find 44 positive integers a,b,c,da,b,c,d such that a+b+c+d=na+b+c+d=n, and gcd(a,b)=lcm
阅读全文
摘要:首先,生成树是指在一个连通图中的连通子图,hanyou图中全部n个顶点,但只有足以构成一棵树的n-1条边。一颗有n个顶点的生成树有且仅有n-1条边,如果生成树中再添加一条边,则必定成环。 而最小生成树则是指在连通网的所有生成树中,所有的代价和最小的生成树。 Kruskal算法 思路:初始边数为1,每
阅读全文
摘要:A. Vasya and Coins Vasya decided to go to the grocery store. He found in his wallet aa coins of 11 burle and bb coins of 22 burles. He does not yet kn
阅读全文