01 2024 档案
摘要:题目大意 给一个 \(10 × 10\) 字符串矩阵,求从 \(L\) 开始(不经过 \(R\) )到 \(B\) 的短路径。 思路 这道题因为是求最短,所以用 \(DFS\) 比较麻烦,于是我用的是 \(BFS\) 做。遇到障碍则跳过,到终点直接退出就行了。 code #include<iostr
阅读全文
摘要:void pushup(int tr){ seg[tr]=seg[tr*2]+seg[tr*2+1]; } void build(int tr,int l,int r){ if(l==r){ seg[tr]=a[r]; return ; } int mid=(l+r)/2; build(tr/2,l
阅读全文
摘要:#include<bits/stdc++.h> #define int long long using namespace std; int len,n,a[100009],g[100009]; signed main(){ scanf("%ld",&n); for(int i=1;i<=n;i++
阅读全文
摘要:#include<bits/stdc++.h> #define int long long using namespace std; int n,m,x,x1,y,z; int a[100010],d[100010],c[100010]; int lowbit(int num){return num
阅读全文
摘要:1st思路 贪心 当遇到左括号深度加一,可如果当前深度大于 $H$ 时深度减二,并且 $ans$ 加一。相当于进行一次翻转操作。 当遇到右括号深度减一,当深度小于零时深度加二,并且 $ans$ 加一。 code #include<bits/stdc++.h> using namespace std;
阅读全文
摘要:#include<bits/stdc++.h> #define int long long using namespace std; int n,a[3],m=1e9+7,c[3][3],b[3][3],x[3][3],a1[3]; void first() { for(int i=1;i<=2;i
阅读全文
摘要:#include<bits/stdc++.h> #include<windows.h> #include <conio.h> using namespace std; void put(string &text, int interval) { int n = text.length(); for
阅读全文
摘要:题目翻译 题意 有一个网格,左上角是 $(0,0)$,右上角是 $(x,y)$。求这个网格中一共有多少个等腰直角三角形。 输入 第一行给定一个 $c$,表示有 $c$ 组数据。 后面 $c$ 行,每行一个 $x$ 和一个 $y$。 输出 每次输出询问的结果。 思路 我们只需要每次枚举一个点,在算出以
阅读全文
摘要:高斯消元 高斯消元是线性代数规划中的一个算法,可用来为线性方程组求解,高斯消元法可以用在电脑中来解决数千条等式及未知数。 ps:若要解出 \(n\) 个未知数的话,则需要 \(n\) 个有意义的方程。 例如有 \(n\) 个方程组,其中一个是 \(0 \times x = 0 \times y\)
阅读全文
摘要:以下便是快读模板供大家食用 #include<bits/stdc++.h> using namespace std; int a,b; inline void read(register int &a) { a=0;char c; while((c=getchar())<48); do a=(a<<
阅读全文
摘要:#include <bits/stdc++.h> #include <windows.h> #include <conio.h> #include <stdlib.h> #include <stdio.h> using namespace std ; void printsetence(string
阅读全文
摘要:#include<bits/stdc++.h> #define int long long using namespace std; const int Max = 500005; int a[Max]; int n,m; int lowbit(int x) { return x & -x; } v
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; struct node1{int l,r,value;}; node1 node[100010]; > node是村树的数组 int a[100010]; > a是输入数组 inline void mt(int
阅读全文
摘要:part1 #include<bits/stdc++.h> #define int long long using namespace std; struct node1{int l,r,value;}; node1 node[2000020]; int a[500010]; void mt(int
阅读全文
摘要:#include <bits/stdc++.h> #define int long long #define MAXM 200010 #define MAXN 100010 using namespace std; struct edge { int next,to,v; } e[MAXM]; in
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; int n,m,ans=1,ans1=0,f[100001]; struct node { int x,y,t; } a[1000010]; int cmp(node x,node y) { if(x.t<y.
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; int a[110][110],b[110][110],c[110][110],m,n,k; double s; int main() { cin>>n>>m>>k; for(int i=1;i<=n;i++)
阅读全文
摘要:#include<bits/stdc++.h> #define int long long using namespace std; int n,k,m=1e9 + 7,c[1010][1010],a[1010][1010],a1[1010][1010],x[1010][1010]; void fi
阅读全文
摘要:#include<bits/stdc++.h> #define int long long using namespace std; int n,a[1000009]; inline void read(register int &a) { a=0;char c; while((c=getchar(
阅读全文
摘要:rt 题目 有一道共 n 个选项的不定项选择题,它的答案至少包含一个选项,由于题目与选项的内容晦涩难懂,你打算通过尝试每一种可能的答案来通过这道题。 初始时所有选项都没有被勾选,你可以执行任意次下述操作: 勾选一个当前未被勾选的选项。 取消勾选一个当前已被勾选的选项。 当你勾选中的选项与答案一致时,
阅读全文
摘要:[COCI2006-2007#2] SJECIŠTA_题解 rt 我们来看一下题目描述 考虑一个有 $n$ 个顶点的凸多边形,且这个多边形没有任何三个(或以上) 的对角线交于一点。 这句话什么意思? 当顶点为$n$的图形为正多边形时便有可能出现一个点是有三条线相交而构成的 如图 如图情况就有三个以上
阅读全文
摘要:[rt](https://www.luogu.com.cn/problem/P5963) ## part1### 题意简述给你 $n$ 张纸牌,每张纸牌有两个面。将 $n$ 张纸牌按一定顺序填入框中。填入卡牌时,不一定需要按照卡牌和框的顺序进行填写(即可以进行位置的调换)。求在一定顺序下式子最小的结
阅读全文
摘要:题目简述 有一块 $n \times m$ 的长方形蛋糕。蛋糕上有两个蜡烛,分别用 $(x_1,y_1)$ 和 $(x_2,y_2)$ 表示。现在有一把刀要把蛋糕切成两半,请问切入的终点和起点在哪? 思路 这道题分类讨论一下就会发现两个点分为两种情况。 第一种情况是竖着切。 第二种情况是横着切。 知
阅读全文
摘要:题目简述 有 $n$ 个点,这些点分为两种类型。第一种,点在 $(x,0)$ 的位置。这些点从 $t_i$ 的时刻开始向北走。第二种,点在 $(0,y)$ 的位置。这些点从 $t_i$ 的时刻开始向东走。在这些点中会出现有两个点在同一时刻出在同一位置的情况,也就是相撞。为了避免这一情况的出现,我们选
阅读全文
摘要:题目简述 有两个矩形,大小分别是 $W \times Y$ 和 $ w \times y$。现在我们要通过折叠将两个矩阵变成一样。 思路 part1 已知一条边折叠一次会变成 $\frac{x}{2}$ 到 $x$ 之间的一个数,所以我们把大矩形折叠到两条边都小于小矩形的两边,然后每次折叠记录一个
阅读全文
摘要:题目 P9253 [PA 2022] Ornitolog 2 题目描述 给你一个长度为 $n$ 的数列,求至少要修改多少个数才能让数列成为交替鹡鸰鸟鸣的音高序列。 思路 这道题有两种情况。 第一种是当前的数比左右两边的数都要小。 还有一种是当前的数比左右两边的数都要大。 1 1 1 \ / / \
阅读全文