02 2021 档案

摘要:dfs: 马的遍历 题目描述 有一个n*m的棋盘(1<n,m<=400),在某个点上有一个马,要求你计算出马到达棋盘上任意一个点最少要走几步 输入格式 一行四个数据,棋盘的大小和马的坐标 输出格式 一个n*m的矩阵,代表马到达某个点最少要走几步(左对齐,宽5格,不能到达则输出-1) 输入输出样例 输 阅读全文
posted @ 2021-02-28 20:56 loliconsk 阅读(129) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> #include<algorithm> #include<cstring> using namespace std; const int maxn = 1000; struct Bigint { int len, a[maxn] 阅读全文
posted @ 2021-02-26 18:13 loliconsk 阅读(107) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> #include<algorithm> #include<vector> #include<queue> using namespace std; int n, m; void topo(vector<int>& rec, qu 阅读全文
posted @ 2021-02-21 15:55 loliconsk 阅读(68) 评论(0) 推荐(0)
摘要:有n个物品的重量和价值分别是wi和vi.从中选出k个物品使得单位重量的价值最大 #include<cstdio> #include<iostream> #include<algorithm> using namespace std; const int INF = 9999999; const in 阅读全文
posted @ 2021-02-19 22:54 loliconsk 阅读(70) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> using namespace std; int main(void) { const int n = 5; const int k = 3; int a[5] = { 2,3,3,5,6 }; int lb = -1, ub 阅读全文
posted @ 2021-02-19 10:22 loliconsk 阅读(43) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<map> #include<iostream> #include<algorithm> using namespace std; typedef pair<double, double> p; typedef multimap<double, p, 阅读全文
posted @ 2021-02-10 17:58 loliconsk 阅读(86) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<cstring> #include<iostream> #include<list> using namespace std; int main(void) { string s; while (cin >> s) { list<char> ch; 阅读全文
posted @ 2021-02-10 12:57 loliconsk 阅读(121) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> #include<algorithm> using namespace std; int maxsum(int* A, int x, int y)//可以求[x,y)上的最大连续和 { if (y - x == 1)return 阅读全文
posted @ 2021-02-09 11:40 loliconsk 阅读(81) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> #include<algorithm> using namespace std; bool solve(int &w) { int w1, w2, d1, d2; cin >> w1 >> d1 >> w2 >> d2; boo 阅读全文
posted @ 2021-02-08 19:29 loliconsk 阅读(105) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> #include<algorithm> #include<sstream> using namespace std; const int maxn = 100005; int LT[maxn], RT[maxn]; int mi 阅读全文
posted @ 2021-02-08 16:48 loliconsk 阅读(90) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> #include<set> #include<algorithm> using namespace std; set<int> s; int main(void) { int R, n; while (cin >> R >> n 阅读全文
posted @ 2021-02-07 20:54 loliconsk 阅读(95) 评论(0) 推荐(0)
摘要:记得删掉时间测试 #include<cstdio> #include<iostream> #include<ctime> using namespace std; char s[2005]; int main(void) { int n; cin >> n; getchar(); for (int 阅读全文
posted @ 2021-02-07 17:08 loliconsk 阅读(88) 评论(0) 推荐(0)
摘要:DFS 油田 BFS Trees on the level abbott的复仇 STL 交换学生 铁轨 团队队列 丑数 模拟 骰子涂色 树 小球下落 阅读全文
posted @ 2021-02-06 21:01 loliconsk 阅读(57) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> #include<cstdlib> #include<queue> #include<vector> #include<cstring> using namespace std; struct Node { bool have_ 阅读全文
posted @ 2021-02-06 20:54 loliconsk 阅读(83) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> #include<cstring> using namespace std; int idx[105][105],m,n; char pic[105][105]; void dfs(int p, int q, int cnt) 阅读全文
posted @ 2021-02-06 20:45 loliconsk 阅读(82) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> using namespace std; #include<cstring> int s[1 << 20]; int main(void) { int t; while (cin >> t && t != -1) { int D 阅读全文
posted @ 2021-02-06 20:43 loliconsk 阅读(63) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<cstring> #include<iostream> #include<vector> #include<queue> using namespace std; struct Node//每一个结点的属性 { int r,c,dir; Node( 阅读全文
posted @ 2021-02-06 19:22 loliconsk 阅读(116) 评论(0) 推荐(0)
摘要:递归排列#include<cstdio> #include<iostream> using namespace std; void print_permutation(int n, int a[], int cur) { if (cur == n) { for (int i = 0; i < 10; 阅读全文
posted @ 2021-02-03 12:48 loliconsk 阅读(75) 评论(0) 推荐(0)
摘要:#include<cstdio> #include<iostream> using namespace std; #include<stack> #include<cstring> int a[10100000]; int main(void) { stack<int> s; int n; whil 阅读全文
posted @ 2021-02-02 18:30 loliconsk 阅读(71) 评论(0) 推荐(0)
摘要:将每一个面朝上都枚举出来,然后在判断以垂直线旋转的四种可能,所以一共6*4种可能 代码如下: #include<cstdio> #include<iostream> using namespace std; #include<cstdlib> #include<cstring> int sta[6] 阅读全文
posted @ 2021-02-01 18:33 loliconsk 阅读(165) 评论(0) 推荐(0)
摘要:思路: 最开始我是这样想的,将所有的组合保存在map中,key值为本校value为目标学校,将所有的值保存好后,用map[i]的值和map[map[i]]的值比较如果相等说明是可以交换的,直到全部比较完,但后来发现每个学校不只有一个人去交换,map的key不能保存相同的值,所以在这个的基础上,将ma 阅读全文
posted @ 2021-02-01 10:18 loliconsk 阅读(123) 评论(0) 推荐(0)