04 2020 档案

摘要:1 #include<iostream> 2 #include<cstdio> 3 #include <map> 4 #include <string> 5 using namespace std; 6 int main() 7 { 8 map<string, int> m; 9 long int 阅读全文
posted @ 2020-04-28 21:31 幻想Elapse 阅读(576) 评论(0) 推荐(0) 编辑
摘要:代码来源 1 #include<iostream> 2 #include <map> 3 #include <iomanip> 4 #include <string> 5 #include <cstring> 6 using namespace std; 7 map<string, bool>m[1 阅读全文
posted @ 2020-04-28 19:46 幻想Elapse 阅读(316) 评论(0) 推荐(0) 编辑
摘要:1 #include <iostream> 2 #include <string> 3 #include <cstring> 4 using namespace std; 5 int main() 6 { 7 char a[501][10];//存储字符串 8 int pos[501];//字符串存 阅读全文
posted @ 2020-04-28 11:24 幻想Elapse 阅读(335) 评论(0) 推荐(0) 编辑
摘要:1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 int N, P; 7 cin >> N >> P; 8 int flag[1100] = { 0 }; 9 int p[65536]; 10 for(int i=0; 阅读全文
posted @ 2020-04-27 15:21 幻想Elapse 阅读(481) 评论(0) 推荐(0) 编辑
摘要:分别在组内排序,先得出组内的排名。最后总体进行排序,得出总体排名。 1 #include <iostream> 2 #include <algorithm> 3 #include <string> 4 #include <cstdio> 5 using namespace std; 6 struct 阅读全文
posted @ 2020-04-27 15:20 幻想Elapse 阅读(918) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2020-04-25 14:38 幻想Elapse 阅读(217) 评论(0) 推荐(0) 编辑
摘要://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 阅读全文
posted @ 2020-04-25 11:06 幻想Elapse 阅读(185) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2020-04-24 23:46 幻想Elapse 阅读(220) 评论(0) 推荐(0) 编辑
摘要:#include <iostream> #include <queue> #include <cstdio> using namespace std; int C; int cmp(const char a[], const char b[])//比较字符串大小的函数 { for (int i = 阅读全文
posted @ 2020-04-24 23:14 幻想Elapse 阅读(435) 评论(0) 推荐(0) 编辑
摘要:冒泡排序: 外层循环N-1次,内循环每两个相邻的数相比较,如果前面的比后面大,二者交换。每一次外循环的结果是前N-i个数中最大的数放第N-i个位置(下标N-i-1)。将N-1个数处理完后,剩下的一个数自然在第一个位置,不需要处理,所以是N-1次外循环。 时间复杂度: 最坏:O(N^2) 最好:O(N 阅读全文
posted @ 2020-04-21 18:54 幻想Elapse 阅读(333) 评论(0) 推荐(0) 编辑
摘要: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; 阅读全文
posted @ 2020-04-18 19:24 幻想Elapse 阅读(210) 评论(0) 推荐(0) 编辑
摘要: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] = { 阅读全文
posted @ 2020-04-18 11:10 幻想Elapse 阅读(522) 评论(0) 推荐(0) 编辑