01 2020 档案
摘要:起初一直看不懂题的意思,最后看了大佬的视频讲解才明白了题的意思。 题意:每次询问重复的时候抵消上一次操作 如果是奇数次的操作则视为障碍阻挡前进 收获:0和1的转换技巧,简单搜索和巧定义全局变量,没必要一定要写出来函数 非函数写法: #include<bits/stdc++.h> using name
阅读全文
摘要:POJ-3495 题解: #include <iostream> #include<algorithm> #include <cstdio> #include <cstdlib> #include <cstring> #include <queue> #define INF 0x3f3f3f3f #
阅读全文
摘要:1.单点修改裸题(HDU1754) #include<iostream> #include<algorithm> using namespace std; const int maxn=2e+5; int n,m,a[maxn]; struct tree{ int l,r,v; }trees[max
阅读全文
摘要:一:差分数组概念 一、差分数组的定义及用途 1.定义:对于已知有n个元素的数列d,建立记录它每项与前一项差值的差分数组f:显然,f[1]=d[1]-0=d[1];对于整数i∈[2,n],我们让f[i]=d[i]-d[i-1]。//f[i]数组为差分数组,d[i]数组为原数组 2.简单性质:(1)计算
阅读全文
摘要:一:模板题与解释 1.仅有定义即可完成优先队列(题面) #include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios_base::sync_with_stdio(0); cin.tie(0);
阅读全文
摘要:一.st取区间最大值 模板题洛谷P3865:https://www.luogu.com.cn/problem/P3865 注意点: 1.f[i][j]=f[i][i+2j-1] 2.预处理时是以2的次幂进行跳的取区间最大值 3.query询问函数: 询问时取的len的方法是由:2x<=r-l+1来取
阅读全文
摘要:const int N=120; int father[N]; int rank1[N]; void init(int Size) { for(int i=1;i<=Size;++i) father[i]=i,rank1[i]=0; } int Find(int x) { while(x!=fath
阅读全文
摘要:1 #include<iostream> 2 using namespace std; 3 int main() { 4 int a,b; 5 int n; 6 while(cin >> n) { 7 cin >> a; 8 for(int i=1;i<n;i++) { 9 cin >> b; 10
阅读全文
摘要:大一上学期c语言课设时候完成了第一个千行代码程序,这也是上大学后第一次的课设任务。 程序中我的管理员部分全部用链表实现的。用户部分读入用户信息和写出用户信息是用“结构体”实现的,但是其中的功能部分仍然用链表实现。 1.课设任务如下: 任务:火车订票系统设计 功能:设计一-火车订票系统,使之能提供下列
阅读全文
摘要:1.普通快速幂 快速幂模板: 1 int Quick_pow(int a,int b) 2 { 3 int ans=1; 4 while(b){ 5 if(b&1) 6 ans=ans*a; 7 a=a*a; 8 b>>=1; 9 } 10 return ans; 11 } 矩阵快速幂模板 1 ma
阅读全文
摘要:一:求约数个数 约数个数定理: a.分解质因数(一个合数可以分通过质因数分解彻底) b.因数和(如何得来:将分解质因数的分开然后相乘共f(n)个) int get_num(int n) { int tot=1; for(int i=2;i*i<=n;++i) { if(n%i==0) { int x
阅读全文
摘要:1 do{ 2 scanf("%d",&a[i++]); 3 count++; 4 }while(getchar()!='\n'); 5 6 \\回车结束类问题终结
阅读全文
摘要:1.油田连通块 链接地址:地址 递归DFS 1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 #include<cstring> 5 using namespace std; 6 char map[110][110]; 7
阅读全文
摘要:001:简单的swap 1 #include <iostream> 2 using namespace std; 3 class A 4 { 5 public: 6 int x; 7 int getX() { return x; } 8 }; 9 void swap( 10 // 在此处补充你的代码
阅读全文
摘要:问题: 如果正整数大于了1000有什么影响? 1.递推式gcd: 1 int gcd(int a,int b) 2 { 3 while(b>0) 4 { 5 int c=a%b; 6 a=b; 7 b=c; 8 } 9 return a; 10 } 2.递归式gcd: 1 int gcd(int a
阅读全文
摘要:题面 001:返回什么才好呢 未懂 1.A& GetObj()//没有明白此处的this指针,定义这个函数的作用为没有明白 1 #include <iostream> 2 using namespace std; 3 class A { 4 public: 5 int val; 6 7 A(int
阅读全文
摘要:题面 001:编程填空:学生信息处理程序 1 #include <iostream> 2 #include <string> 3 #include <cstdio> 4 #include <cstring> 5 #include <sstream> 6 #include <cstdlib> 7 us
阅读全文
摘要:感觉这道题有点蠢,只要硬磕就可以做出来。。。。但是没有用指针,看到网上的都比较复杂我就给个我的简单做法; 1 #include<stdio.h> 2 3 int vis[100]; 4 5 int main() 6 { 7 int n,m,i,k,count=0; 8 scanf("%d%d",&n
阅读全文

浙公网安备 33010602011771号