第六章学习的主要内容如下: 这是课后习题的一道题: 1 void DFS_AM(AMGraph G, int v) 2 { //图G为邻接矩阵类型 3 cout << v << " "; //访问第v个顶点 4 visited[v] = true; 5 for(w=G.vexnum-1; w>=0; ...
分类:
其他好文 时间:
2020-06-13 17:45:56
阅读次数:
77
本篇中使用的调试函数如下 1 template<typename T> 2 void print_vector(vector<T> a){ 3 if(a.size() == 0) 4 cout << "empty" << endl; 5 else{ 6 for(int i = 0; i < a.si ...
分类:
编程语言 时间:
2020-06-13 15:56:59
阅读次数:
78
这里的输入图像是.png类型的原图像,3通道图像,亲测无误。 1 #include "pch.h" 2 #include <iostream> 3 #include <opencv2/opencv.hpp> 4 #include <opencv2/imgproc/types_c.h> 5 using ...
分类:
其他好文 时间:
2020-06-12 12:31:14
阅读次数:
206
1.返回迭代器 map_date.begin(); map_date.end(); map_date.find(find_date); #include <iostream> #include <vector> #include <string> #include <map> using std:: ...
分类:
编程语言 时间:
2020-06-11 21:35:04
阅读次数:
82
这题不是很难哦,为什么要看题解呢~ 看代码: #include<bits/stdc++.h>//万能头文件 using namespace std; int a[105];//保存电线上有多少鸟 int main() { int n; cin>>n;//读入 for(int i=1;i<=n;i++ ...
分类:
其他好文 时间:
2020-06-11 19:43:49
阅读次数:
50
变量的例子 #include<iostream> using namespace std; int main(){ int a = 10; //打印出a=10 cout << "a="<<a<<endl; system("pause"); return 0; } 3常量的例子 /* 3.1宏常量 # ...
分类:
编程语言 时间:
2020-06-11 19:38:26
阅读次数:
62
CF3A Shortest path of the king Luogu题地址 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <queue> using namespace ...
分类:
其他好文 时间:
2020-06-11 16:24:45
阅读次数:
50
地址:http://poj.org/problem?id=1990 题意: 给出n只,每只两个属性: v,x 每两只的和为:sum=max(v1,v2)*fabs(x1-x2),求所有n*(n-1)/2对的和 解析: 对v值进行从小到大排序,那么对于当前羊的v值,它之前的羊都要乘这个v。 那么对于当 ...
分类:
编程语言 时间:
2020-06-11 00:56:02
阅读次数:
57
传送门 A Sequence with Digits standard input/output 1 s, 256 MB Submit Add to favourites x14744 a的通项中一定会有一个出现数字0, 自此之后的a不变化, 判断一下即可 最长的是 a1 = 54, 28217才出 ...
分类:
其他好文 时间:
2020-06-11 00:27:36
阅读次数:
60
阿姆斯特朗数 时间限制:1秒 内存限制:128M 题目描述 编程找出所有的三位数到七位数中的阿姆斯特朗数。阿姆斯特朗数也叫水仙花数,它的定义如下:若一个n位自然数的各位数字的n次方之和等于它本身,则称这个自然数为阿姆斯特朗数。例如,153(153=1X1X1+3X3X3+5X5X5)是一个三位的阿姆 ...
分类:
其他好文 时间:
2020-06-10 21:22:34
阅读次数:
98