#include<iostream> #include<cstdio> using namespace std; const int N=100010; int p[N]; int d[N]; int find(int x) { if(p[x]!=x) { int u=find(p[x]); d[x ...
分类:
其他好文 时间:
2020-02-01 16:15:15
阅读次数:
47
定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, }; 它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要 ...
分类:
其他好文 时间:
2020-02-01 12:30:41
阅读次数:
74
1 #include<cstdio> 2 #include<iostream> 3 #include<algorithm> 4 #include<queue> 5 #include<map> 6 #include<vector> 7 #include<set> 8 #include<string> ...
分类:
其他好文 时间:
2020-01-31 18:49:43
阅读次数:
71
这道题就是单调队列的裸题 今天刚学的单调队列 前几天刚学习完单调栈 感觉这两个东西非常相似哇 黄哥的一句话说破了他 他俩的区别就像队列和栈的区别233333 有关这道题倒没有太多说的 就是模拟队列 单调递增递减来找到区间最值 我这里用了数组模拟 问题就是G++ T了/// 而C++ AC 就很迷。。 ...
分类:
其他好文 时间:
2020-01-31 18:32:19
阅读次数:
79
// #include<iostream> #include<cstring> #include<queue> #include<stack> #include<stdio.h> using namespace std; const int INF=0x3f3f3f3f; const int N=3 ...
分类:
其他好文 时间:
2020-01-31 16:01:31
阅读次数:
71
题目大意: 有 4x4 的正方形,每个格子要么是黑色,要么是白色,当把一个格子的颜色改变(黑 白或者白 黑)时,其周围上下左右(如果存在的话)的格子的颜色也被反转,问至少反转几个格子可以使 4x4 的正方形变为纯白或者纯黑? 下面说说自己的收获 创建结构数组比结构体里包含数组要方便 这里使用线性存储 ...
分类:
其他好文 时间:
2020-01-31 14:21:40
阅读次数:
52
在13枚硬币中找出fake的那一个 输入:三次天平称量结果 1 package poj.ProblemSet; 2 3 import java.util.Scanner; 4 5 /* 6 我怎么觉得是贪心算法呢? 7 起初对所有硬币标记0; 8 如果是even,则两边所有的硬币记为真(记233); ...
分类:
编程语言 时间:
2020-01-31 14:20:15
阅读次数:
74
迷宫问题 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 49149 Accepted: 26684 Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, ...
分类:
其他好文 时间:
2020-01-31 12:19:13
阅读次数:
47
Lake Counting Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 56258 Accepted: 27405 Description Due to recent rains, water has pooled in va ...
分类:
其他好文 时间:
2020-01-31 10:53:47
阅读次数:
89
Bessie noted that although humans have many universities they can attend, cows have none. To remedy this problem, she and her fellow cows formed a new ...
分类:
其他好文 时间:
2020-01-31 10:34:26
阅读次数:
62