文章列表
朴素 Dijkstra算法 (acwing)
摘要:/*
3 3
1 2 2
2 3 1
1 3 4
*/ //找到到达起点的最短路
#include&
题目 1129: C语言训练-排序问题<2>
摘要:#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[10];
for(int i=0;i<10;i……
题目 1128: C语言训练-排序问题<1>(简便)
摘要:#include<bits/stdc++.h>using namespace std;int main(){ int a[4]; for(int i=0;i<4;i++) cin>>a[i……
题目 1505: 蓝桥杯算法提高VIP-单词个数统计(简便快捷)
摘要:#include<iostream>using namespace std;int main(){ string a; int b=0; while(cin>>a) b++; ……
C语言程序设计教程(第三版)课后习题例6.5的求和训练(用c语言写的)
摘要:解题思路:注意题目的保留两位小数点,一般用float或者double。题目要求三位数的和,这里可以用for或者while。实例代码:# include <stdio.h># include <math……
拓扑排序(acwing)
摘要://输入一个图 判断是否为拓扑排序(没有环)
/* 3 3
1 2
2 3
1 3
*/ //样例输出为1 2 3
#in
图中点的层次(从1到n的最短路)(bfs)(acwing)
摘要:/* 4 5
1 2
2 3
3 4
1 3
1 4
*/ &n
树的重心(最小的 子树的最大节点)(bfs,邻接表)(acwing)
摘要:#include<bits/stdc++.h>
using namespace std;
const int N=10050;
int n;
int he[N],e[N],ne[N],idx=……