摘要:
1 #include <iostream> 2 #include <algorithm> 3 using namespace std; 4 struct node//定义国家结构体 5 { 6 int order; 7 double gold, mdl, ppl; 8 int rank[5]; 9 阅读全文
摘要:
//sort(a+i,a+j) >a[i]到a[j-1]被排序。 1 #include <iostream> 2 #include <algorithm> 3 4 using namespace std; 5 long int pos[1000001], neg[1000001],price[100 阅读全文
摘要:
1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 long int a[1000005]; 5 long int N; 6 bool cmp(int a,int b) 7 { 8 return a>b; 9 } 1 阅读全文
摘要:
#include <iostream> #include <queue> #include <cstdio> using namespace std; int C; int cmp(const char a[], const char b[])//比较字符串大小的函数 { for (int i = 阅读全文
摘要:
冒泡排序: 外层循环N-1次,内循环每两个相邻的数相比较,如果前面的比后面大,二者交换。每一次外循环的结果是前N-i个数中最大的数放第N-i个位置(下标N-i-1)。将N-1个数处理完后,剩下的一个数自然在第一个位置,不需要处理,所以是N-1次外循环。 时间复杂度: 最坏:O(N^2) 最好:O(N 阅读全文
摘要:
1 #include <iostream> 2 #include <cstdio> 3 #include <iomanip> 4 #define infinity 65535 5 using namespace std; 6 int D[10001][10001];//储存最短路径 7 int N; 阅读全文
摘要:
1 #include <iostream> 2 #define infinity 65535 3 using namespace std; 4 int cnt[1000];//S到某点最短路径的数目 5 int low[1000];//S到某点最短路径长度 6 int high[1000] = { 阅读全文