Dijkstra是求单源最短路的一种算法,它不能够处理含有负权边的图。本质是递推,依次求出距离起点最近的点。 C++ 板子 #include<bits/stdc++.h> #define ll long long /* 题目链接:https://www.luogu.com.cn/problem/P3 ...
分类:
编程语言 时间:
2020-10-22 22:15:58
阅读次数:
24
比赛链接:https://codeforces.com/contest/1433 #A. Boring Apartments ##题解 模拟即可。 ##代码 #include <bits/stdc++.h> using namespace std; int main() { ios::sync_wi ...
分类:
其他好文 时间:
2020-10-21 20:39:03
阅读次数:
25
#include <bits/stdc++.h> #include <bits/extc++.h> using namespace std; using namespace __gnu_pbds; typedef pair<int,int> pii; tree<pii,null_type,less< ...
分类:
其他好文 时间:
2020-10-21 20:30:50
阅读次数:
25
#include <bits/stdc++.h> using namespace std; int a[103][103],m; int xx[4]={0,0,1,-1},yy[4]={1,-1,0,0}; int f[103][103]; bool mp[103][103]; void dfs(i ...
分类:
其他好文 时间:
2020-10-20 16:35:04
阅读次数:
25
1 #include<bits/stdc++.h> 2 void quickSort(int a[],int first,int end) 3 { 4 if(first==end) return; 5 int i = first,j = end,temp; 6 while(i<j){ 7 while ...
分类:
编程语言 时间:
2020-10-20 16:26:37
阅读次数:
21
Prime digit replacements 枚举每一位放数字还是放未知的,如果为止的就拿1代替单独存 因为要有8个,所以我们可知未知的一定是三的倍数,末尾一定是1,3,7,然后暴力搞一搞(剪枝跑得飞快) 1 #include<bits/stdc++.h> 2 #define reg regis ...
分类:
其他好文 时间:
2020-10-19 22:57:02
阅读次数:
18
求这个灯管的发光样式种类,发光的部分需连在一起 思路 二进制枚举+检测连通,信誓旦旦地交了个69;事后发现建图的时候少建了一条边,分没了 #include<bits/stdc++.h> using namespace std; const int N=8; int vis[N], light[N]; ...
分类:
其他好文 时间:
2020-10-18 17:13:14
阅读次数:
40
Given an input string s, reverse the order of the words. A word is defined as a sequence of non-space characters. The words in s will be separated by ...
分类:
其他好文 时间:
2020-10-18 10:19:49
阅读次数:
29
#include<bits/stdc++.h>包含了目前c++所包含的所有头文件 对比: #include <iostream> #include <cstdio> #include <fstream> #include <algorithm> #include <cmath> #include < ...
分类:
编程语言 时间:
2020-10-18 09:59:50
阅读次数:
17
下面是ACM比赛中常用的几个库 #include<bits/stdc++.h> #include <iostream> #include <cstdio> #include <fstream> #include <algorithm> #include <cmath> #include <deque ...
分类:
其他好文 时间:
2020-10-13 17:54:20
阅读次数:
37