首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
cczz
加油
关注
发消息
文章
0
题解
74
发帖
0
笔记
0
Ta的粉丝
0
关注数
0
粉丝数
0
获赞数
97
阅读数
8755
确定比赛名次 (拓扑排序)题解:
#include<bits/stdc++.h> using namespace std; const int maxn = 500 + 5; vector<int> v[maxn]; // 记录 i 指向的节点 int lev[maxn]; // 记录 ...
P1566
2025年8月31日 20:44
回复 0
|
赞 1
|
浏览 28
最短路 (Floyd算法)题解:
#include<bits/stdc++.h> using namespace std; const int maxn = 100 + 5; const int INF = 1e9; // 使用一个较大的数避免溢出 int mp[maxn][maxn]; int...
P1565
2025年8月31日 18:11
回复 0
|
赞 0
|
浏览 18
畅通工程 (kruskal + 并查集)题解:
#include<bits/stdc++.h> using namespace std; const int maxn = 100 + 5; struct node{ int u, v, w; }edge[maxn * maxn]; bool cmp(no...
P1312
2025年8月31日 17:39
回复 0
|
赞 0
|
浏览 24
逃离迷宫 (bfs)题解:
#include<bits/stdc++.h> using namespace std; int m, n; int k, x1, y1, x2, y2; char mp[105][105]; // 三维访问标记:x, y, 转弯次数 int vis[105][...
P1681
2025年8月30日 16:29
回复 0
|
赞 0
|
浏览 17
压缩日期 (采用位运算)题解:
#include<bits/stdc++.h> using namespace std; // 判断闰年 int isLeapYear(int y) { if(y % 400 == 0 || (y % 4 == 0 && y % 100 !=...
P1936
2025年8月29日 21:37
回复 0
|
赞 1
|
浏览 44
畅通工程 (并查集-路径压缩)模板题解:
#include<bits/stdc++.h> using namespace std; int fa[1000 + 5]; int find(int x) { return x == fa[x] ? x : (fa[x] = find(fa[x])); ...
P1319
2025年8月29日 19:59
回复 0
|
赞 0
|
浏览 34
三个数的和 (双指针)题解:
#include<iostream> #include<cstdlib> #include<vector> #include<algorithm> using namespace std; int main(){ ...
P5286
2025年8月23日 21:38
回复 0
|
赞 0
|
浏览 42
层次遍历 (创建BST优化)题解:
#include<iostream> #include<cstdlib> #include<queue> #include<climits> // 用于INT_MAX using namespace std; typedef s...
P1924
2025年8月23日 16:59
回复 0
|
赞 0
|
浏览 59
数组排序 (stringstream分割)题解:
#include <iostream> #include <cstdlib> #include <vector> #include <string> #include <sstream> #include <alg...
P1798
2025年8月22日 19:28
回复 0
|
赞 1
|
浏览 52
找出字符串的最长回文子串(回文子串模板题) 题解:
中心扩展法: 回文串的长度都是奇数,我们称其为奇回文串, 例如 bcb。 回文串的长度都是偶数,我们称其为偶回文串, 例如 bccb。 比如子串 abccba,我们可以从头遍历每个字母,若是奇回文串,则将其视作中心点,若是偶回文串,则将其与其后面一位视为中心,...
P5278
2025年8月21日 21:45
回复 0
|
赞 0
|
浏览 52
石油储藏 (DFS解法,BFS解法)题解:
1.DFS解法 #include<bits/stdc++.h> using namespace std; const int maxn = 100 + 5; char mpt[maxn][maxn]; int vis[maxn][maxn]; i...
P1564
2025年8月21日 20:18
回复 0
|
赞 2
|
浏览 51
骑车路线 (dp解法,连续LCS变种)题解:
#include<bits/stdc++.h> using namespace std; int dp[1000 + 5]; // 以a[i]为顶峰的最大爬坡高度 int a[1000 + 5]; int main(){ int n; w...
P1737
2025年8月19日 15:02
回复 0
|
赞 0
|
浏览 67
最长连续公共子序列(dp解法) 题解:
dp[i][j]表示以a[i]和b[i]结尾的最长连续公共子序列长度,要求a[i]与b[i]必须为最长连续公共子序列的结尾,否则dp=0 #include<bits/stdc++.h> using namespace std; int dp[1000 ...
P1730
2025年8月19日 14:49
回复 0
|
赞 5
|
浏览 84
最长公共子序列(dp解法) 题解:
#include<bits/stdc++.h> using namespace std; int dp[1000 + 5][1000 + 5]; int main(){ string a, b; while(cin >> a &...
P1731
2025年8月19日 14:28
回复 0
|
赞 0
|
浏览 48
最大子串和 (dp解法)题解:
#include<bits/stdc++.h> using namespace std; int dp[100 + 5]; // 以a[i]结尾的最大连续子串值,必须包括a[i] int a[100 + 5]; long long maxx; int main...
P1703
2025年8月18日 17:42
回复 0
|
赞 0
|
浏览 92
迷宫 (bfs模板题)题解:
#include<bits/stdc++.h> using namespace std; const int maxn = 100 + 5; char mp[maxn][maxn]; int vis[maxn][maxn]; int dir[4][2] = {0,...
P1563
2025年8月15日 16:03
回复 0
|
赞 2
|
浏览 117
统计同成绩学生人数 题解(map容器):
#include<bits/stdc++.h> using namespace std; int main(){ int n; while(cin >> n){ if(!n) break; map<int, int&g...
P1329
2025年8月14日 19:38
回复 0
|
赞 1
|
浏览 107
题解思路:插入分支过程判断是否存在孩子节点,若不存在则可确定为父节点
#include<bits/stdc++.h> using namespace std; typedef struct node{ int data; struct node *lchild, *rchild; }*BitTree; void Inser...
P1396
2025年8月14日 19:30
回复 0
|
赞 1
|
浏览 124
二叉搜索树 题解:
#include<bits/stdc++.h> using namespace std; typedef struct node{ int data; struct node *lchild, *rchild; }*BitTree; void Inser...
P1317
2025年8月14日 19:10
回复 0
|
赞 0
|
浏览 113
二叉排序树(模板题)题解:
#include<bits/stdc++.h> using namespace std; typedef struct node{ int data; struct node *lchild, *rchild; }*BitTree; void Inser...
P1411
2025年8月14日 18:42
回复 0
|
赞 1
|
浏览 111
1
2
3
4
本科学校:bilibili大学
目标学校:无
点此申请N诺身份认证
获得 noobdream 认证,享受多重认证福利!