02 2020 档案
摘要:https://www.luogu.com.cn/problem/P1341 https://blog.csdn.net/STILLxjy/article/details/51956183?depth_1-utm_source=distribute.pc_relevant.none-task&utm
        阅读全文
                
摘要:https://www.luogu.com.cn/problem/P1330 #include<bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; int cnt[2]; int color[maxn]; vector<int>
        阅读全文
                
摘要:https://www.luogu.com.cn/problem/P2661 #include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; int fa[maxn]; int cnt,n,a,ans = 0x3f3f3
        阅读全文
                
摘要:https://www.luogu.com.cn/problem/P1197 #include<bits/stdc++.h> using namespace std; const int maxn = 4e5 + 5; int a, b, n, m, k; int head[maxn], tot, 
        阅读全文
                
摘要:https://www.luogu.com.cn/problem/P1908 归并排序是用来求逆序对的 归并排序的思想就是分治 #include <bits/stdc++.h> using namespace std; #define int long long const int maxn = 5
        阅读全文
                
摘要:https://www.luogu.com.cn/problem/P1010 刚刚看到这个题时,有点懵,如果说这是个数学题 比如说7,应该先求出7 = 4 + 2 + 1; 即先分解出里面应该有最多的2的个数,然后再往下递推 算出2的多少次幂最接近给出的n; 用原来n的数减去2的幂,如果这个数大于2
        阅读全文
                
摘要:https://www.luogu.com.cn/problem/P3386 #include <bits/stdc++.h> using namespace std; const int maxn = 1e3 + 10; int n,m,e,link[maxn][maxn],ans; int us
        阅读全文
                
摘要:https://www.luogu.com.cn/problem/P2158 #include <bits/stdc++.h> using namespace std; #define int long long const int maxn = 4e4 + 10; int v[maxn], phi
        阅读全文
                
摘要:https://www.luogu.com.cn/problem/P1582 #include <bits/stdc++.h> using namespace std; #define int long long int n,k; //取出1的个数 int check(int x){ int c =
        阅读全文
                
摘要:https://www.luogu.com.cn/problem/P1031 #include <bits/stdc++.h> #define int long long using namespace std; int n,s; int a[105]; signed main() { //freo
        阅读全文
                
摘要:https://www.acwing.com/problem/content/1326/ 思路: 枚举起点 正反方向 如果满足.输出 #include <bits/stdc++.h> using namespace std; int n; int g[16][16]; int dx[4] = {-1
        阅读全文
                
摘要:给定一个单链表 L1→L2→⋯→Ln-1→Ln,请编写程序将链表重新排列为 Ln→L1→Ln−1→L2→⋯。例如:给定L为1→2→3→4→5→6,则输出应该为6→1→5→2→4→3。 输入格式: 每个输入包含1个测试用例。每个测试用例第1行给出第1个结
        阅读全文
                
摘要:https://www.acwing.com/problem/content/101/ #include <bits/stdc++.h> using namespace std; const int maxn = 5e3 + 10; int N, R, x, y, z, a[maxn][maxn],
        阅读全文
                
摘要:给定一张 n 个点的带权无向图,点从 0~n-1 标号,求起点 0 到终点 n-1 的最短Hamilton路径。 Hamilton路径的定义是从 0 到 n-1 不重不漏地经过每个点恰好一次。 输入格式 第一行输入整数n。 接下来n行每行n个整数,其中第ii行第jj个整数表示点ii到jj的距离(记为
        阅读全文
                
摘要:https://www.acwing.com/problem/content/99/ 假设现在有两个自然数A和B,S是AB的所有约数之和。 请你求出S mod 9901的值是多少。 输入格式 在一行中输入用空格隔开的两个整数A和B。 输出格式 输出一个整数,代表S mod 9901的值。 数据范围 
        阅读全文
                
摘要:坐车最长的时间和坐车最短的时间的比值尽可能的小。 输入格式: 第一行输入两个正整数,,分别代表站点的个数以及所有站点之间路的条数。 接下来的 M行每行包括三个正整数,, 表示从站点u坐车到站点v需要w单位的时间。当然,从站点v坐车到站点u也需要w单位的时间。 最后一行输入两个正整数分别代表小丁家所在
        阅读全文
                
摘要:分而治之,各个击破是兵家常用的策略之一。在战争中,我们希望首先攻下敌方的部分城市,使其剩余的城市变成孤立无援,然后再分头各个击破。为此参谋部提供了若干打击方案。本题就请你编写程序,判断每个方案的可行性。 输入格式: 输入在第一行给出两个正整数 N 和 M(均不超过10 000),分别为敌方城市个数(
        阅读全文
                
摘要:战争中保持各个城市间的连通性非常重要。本题要求你编写一个报警程序,当失去一个城市导致国家被分裂为多个无法连通的区域时,就发出红色警报。注意:若该国本来就不完全连通,是分裂的k个区域,而失去一个城市并不改变其他城市之间的连通性,则不要发出警报。 输入格式: 输入在第一行给出两个整数N(0 < N ≤ 
        阅读全文
                
摘要:本题给定一个庞大家族的家谱,要请你给出最小一辈的名单。 输入格式: 输入在第一行给出家族人口总数 N(不超过 100 000 的正整数) —— 简单起见,我们把家族成员从 1 到 N 编号。随后第二行给出 N 个编号,其中第 i 个编号对应第 i 位成员的父/母。家谱中辈分最高的老祖宗对应的父/母编
        阅读全文
                
摘要:对给定的字符串,本题要求你输出最长对称子串的长度。例如,给定Is PAT&TAP symmetric?,最长对称子串为s PAT&TAP s,于是你应该输出11。 输入格式: 输入在一行中给出长度不超过1000的非空字符串。 输出格式: 在一行中输出最长对称子串的长度。 输入样例: Is PAT&T
        阅读全文
                
摘要:给定一棵二叉树的后序遍历和中序遍历,请你输出其层序遍历的序列。这里假设键值都是互不相等的正整数。 输入格式: 输入第一行给出一个正整数N(≤),是二叉树中结点的个数。第二行给出其后序遍历序列。第三行给出其中序遍历序列。数字间以空格分隔。 输出格式: 在一行中输出该树的层序遍历的序列。数字间以1个空格
        阅读全文
                
摘要:220. 最大公约数 给定整数N,求1<=x,y<=N且GCD(x,y)为素数的数对(x,y)有多少对。 GCD(x,y)即求x,y的最大公约数。 输入格式 输入一个整数N 输出格式 输出一个整数,表示满足条件的数对数量。 数据范围 1≤N≤1e7 1≤N≤1e7 输入样例: 4 输出样例: 4这个
        阅读全文
                
摘要:211. 计算系数https://www.acwing.com/problem/content/213/ 给定一个多项式(ax+by)k(ax+by)k,请求出多项式展开后xnymxnym项的系数。 输入格式 共一行,包含 5 个整数,分别为 a,b,k,n,m,每两个整数之间用一个空格隔开。 输出
        阅读全文
                
摘要:一 : 定理 费马小定理 扩展欧几里德 乘法逆元 https://www.cnblogs.com/xcfxcf/p/12304658.html 欧拉定理 中国剩余定理 1079 中国剩余定理http://www.51nod.com/Challenge/Problem.html#problemId=1
        阅读全文
                
摘要:4 反素数 198. 反素数 https://www.acwing.com/problem/content/description/200/ 确定前10个质数的指数,指数连续且单调递减 总乘积不超过n ,同时记录约数的个数 1 #include <bits/stdc++.h> 2 using nam
        阅读全文
                
摘要:反思了近阶段自己的状态,假学习假努力正在 持续中...ing 一 :当下很忙很满没空做 其实并没有那么多的事情,或者可以把很多事情按时间 按难易 排序,一下子轻松多了 二 :假努力 不知道为啥努力 1 承认自己浪费时间 2 不要用时间来衡量勤奋 3 目标明确,勤奋前先思考 4 强化执行力 5 不断修
        阅读全文
                
摘要:例题 hdu1576 A/B http://acm.hdu.edu.cn/showproblem.php?pid=1576 题意:已知n(n = A % 9973) ,A%B=0,gcd(B,9973)=1; 求:(A / B) % 9973 法一 暴力出奇迹 本题没有给A,给了n以及和A的关系,所
        阅读全文
                
摘要:3 区间筛法 196. 质数距离https://www.acwing.com/problem/content/198/ 给定两个整数L和U,你需要在闭区间[L,U]内找到距离最接近的两个相邻质数C1和C2(即C2-C1是最小的),如果存在相同距离的其他相邻质数对,则输出第一对。 同时,你还需要找到距
        阅读全文
                
摘要:P1019 单词接龙 #include <bits/stdc++.h> using namespace std; int n; string s[25]; int vis[25]; char ch; int mc[25][25];//重叠的最小部分 int an;//每次搜到的当前最长长串 int 
        阅读全文
                
摘要:KMP https://blog.csdn.net/v_july_v/article/details/7041827 P3375 【模板】KMP字符串匹配 1 #include <bits/stdc++.h> 2 3 using namespace std; 4 const int maxn = 1
        阅读全文
                
摘要:P1135 奇怪的电梯 a == b这种情况要记得判断 #include <bits/stdc++.h> using namespace std; int n,a,b; int d[210][210]; int main(){ freopen("in","r",stdin); ios::sync_w
        阅读全文
                
摘要:P1057 传球游戏 #include <bits/stdc++.h> using namespace std; int n,m; int dp[40][40]; int main(){ //freopen("in","r",stdin); ios::sync_with_stdio(0); cin 
        阅读全文
                
摘要:P3366 【模板】最小生成树 #include <bits/stdc++.h> using namespace std; const int nn = 5010; const int mm = 2e5 + 5; int n,m,fa[nn]; int ans,cnt; struct node{ i
        阅读全文
                
摘要:P4779 【模板】单源最短路径(标准版 #include <bits/stdc++.h> using namespace std; const int nn = 1e5 + 5; const int mm = 2e5 + 5; int d[nn],head[nn],ver[mm],edge[mm]
        阅读全文
                
摘要:https://www.luogu.com.cn/problem/P2024 创建三个集合,1同类域,2捕食域,3天敌域 x y是同类,说明x1-y1,x2-y2,x3-y3; x吃y 说明x捕食的物种是y的同类(x2 - y1),x是y的天敌(x3-y2) op = 1的时候,说明x,y是同类,与
        阅读全文
                
摘要:这一部分的功能和树状数组一样,这里是树状数组的模板 除了求和之外,还能解决区间最小最大值,区间染色 1 单点修改,区间查询 P3374 【模板】树状数组 1 #include <bits/stdc++.h> using namespace std; #define int long long con
        阅读全文
                
摘要:这一部分和线段树基础的功能一样 线段树模板的链接 lowbit(x)覆盖长度 c[x]的父节点t[x + lowbit(x)] 单点修改 区间查询 P3374 【模板】树状数组 1 1 #include <bits/stdc++.h> 2 3 using namespace std; 4 #defi
        阅读全文
                
摘要:C: 组合数 题目描述 从 1 到 N 的整数中挑选一些数,组成集合的方案数是可算的。如果加上 M 个限制:某 2 个数不能 同时选又要怎样计算? 输入 第一行包含 2 个整数 N 和 M,1≤N≤20,1≤M≤400。 下面 M 行,每行 2 个不同的整数 a 和 b 表示这 2 个数不能同时选。
        阅读全文
                
摘要:给一个字符串 T,问在字符串 T 中可以包含最多多少个不重叠的字符串 S。 字符串中的每个字符为小写或者大写字母。 输入 第一行输入一个字符串 S。 第二行输入一个字符串 T。 输出 输出一行,包括一个整数表示答案。 样例输入 Copy Aba Abababa 样例输出 Copy 1 提示 50%的
        阅读全文
                
摘要:D: 找素数 题目描述 素数又称质数,是指一个大于 1 的正整数,如果除了 1 和它本身以外,不能再被其它的数整除, 例如:2、3、5、97 等都是素数。2 是最小的素数。 现在,给你 n 个数字,请你从中选取一部分,用它们拼出一个最大的素数。 注意:某个数字出现多少次你就可以用多少次,6 与 9 
        阅读全文
                
摘要:问题 I: Anti-Division(容斥原理) 题目描述 You are given four integers A, B, C, and D. Find the number of integers between A and B (inclusive) that can be evenly 
        阅读全文
                
摘要:map #include <bits/stdc++.h> using namespace std; #define int long long map<char,string> mp; signed main() { ios::sync_with_stdio(0); mp['0'] = "0000"
        阅读全文
                
摘要:模板图论进阶 ACM题集以及各种总结大全 https://blog.csdn.net/liuqiyao_01/article/details/9079611?depth_1-utm_source=distribute.pc_relevant_right.none-task&utm_source=di
        阅读全文
                
 
                    
                
 浙公网安备 33010602011771号
浙公网安备 33010602011771号