原创 排序 pat1117
#include<stdio.h> #include<algorithm> using namespace std; const int maxv = 1e5 +10; int n; int num[maxv]; bool cmp(i
原创 C++讀取和寫入CSV文件,實現判斷文件格式,並且特定的排序輸出的實例
功能: 讀取、解析csv文件的內容,再打印出每一個聯繫人的數據; 能夠根據客戶輸入的屬性KEY,來實現以KEY爲依據來排序,並將排序結果打印出來; 能夠對錯誤格式的文件進行檢測; 數據流: 首先引用#include<fstream>
原创 並查集 pat1114
#include <iostream> #include<algorithm> #include<cstdio> //1114 using namespace std; int father[10000];//因爲是4位id bool
原创 最低公共祖先 pat1151
#include <iostream> #include<queue> #include<vector> #include<map> //1151 const int N = 1e4+5; using namespace std; in
原创 二叉樹遍歷 pat 1130
#include <iostream> #include<queue> #include<vector> //1130 using namespace std; int n; const int N =25; int vis[N] ={
原创 圖的遍歷 pat1013
#include <iostream> #include<vector> #include<algorithm> #include<cstring> //1013,bfs using namespace std; const int N
原创 最短路徑 pat 1003
#include <iostream> //1003 using namespace std; const int N = 510; const int inf = 1e9; int n,m,st,ed; int vis[N]={0};
原创 圖論 pat 1142
#include <iostream> #include<vector> const int maxv = 205; using namespace std; //1142 //題設定點標號爲從1開始的注意!!! //判斷的時候,容易漏
原创 圖的遍歷 bfs pat1076
#include <iostream> //1076,bfs #include<map> #include<vector> #include<cstring> #include<queue> using namespace std; c
原创 圖的遍歷 dfs pat 1034
#include <iostream> //1034,dfs #include<map> using namespace std; const int maxv = 2005; const int inf = 1e9; map<stri
原创 最短路徑 pat 1103
#include <iostream> #include<vector> #include <iostream> #include <vector> #include <cmath> using namespace std;
原创 圖的遍歷 pat 1021
#include <iostream> #include<vector> #include<algorithm> //1021,bfs using namespace std; const int N = 1e4+5; int fa[
原创 最短路徑 pat1111
#include <iostream> #include<vector> //1111 //問題1 不夠細心 //2 先後順序搞清楚 //3 一定要記得初始化 //4 命名 的時候記得清楚一點 //5 審題一定要自習,題目要看完整 us
原创 最短路徑 pat 1076
#include <iostream> #include<vector> //1072 using namespace std; int n,m,k,Ds; const int N = 1030; const int inf = 1e9
原创 排序 1025
#include <iostream> #include<cstdio> #include<algorithm> #include<cstring> using namespace std; const int maxv = 30010