![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
编程练习
Sansui_Meng
985硕士在读,放养阶段,自学C++
Github:https://github.com/mengssui
展开
-
C语言求行列式的值
矩阵行列式的值求法:因此分为三个步骤:计算逆序数(需要用到全排列的算法)求和根据逆序数决定正负#include<stdio.h>#include<math.h>#include<time.h>#include<stdlib.h>void swap(int* x, int* y){ //交换 int tmp = *x; *x = *y; *y = tmp;}int rear(int* arr, int.原创 2020-08-15 18:55:54 · 4912 阅读 · 2 评论 -
任意矩阵螺旋输出的C实现
以下是任意维度数量小于等于100的二维数组的螺旋矩阵的输出实现如果要是实现任意数组,要使用动态分配数组。 实现复杂的原因是要判断最后一个位置之后不能再有空格,否则很容易实现 输入:维度和值输出:螺旋输出,空格分隔,最后一个输出后没有空格#include <stdio.h>int main() { int matrix[100][100]; int m; int n; //input 输入几行几列 scanf("%d%d".原创 2020-08-15 10:46:30 · 253 阅读 · 0 评论 -
03-树2 List Leaves (25 分)
Given a tree, you are supposed to list all the leaves in the order of top down, and left to right.Input Specification:Each input file contains one test case. For each case, the first line gives a po...原创 2019-05-13 20:41:34 · 133 阅读 · 0 评论 -
02-线性结构4 Pop Sequence
数据结构习题题目:Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, …, N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop se...原创 2019-05-07 13:22:47 · 127 阅读 · 0 评论 -
06-图1 列出连通集 (25 分)
题目:给定一个有NN个顶点和EE条边的无向图,请用DFS和BFS分别列出其所有的连通集。假设顶点从0到N-1N−1编号。进行搜索时,假设我们总是从编号最小的顶点出发,按编号递增的顺序访问邻接点。输入格式:输入第1行给出2个整数NN(0<N\le100<N≤10)和EE,分别是图的顶点数和边数。随后EE行,每行给出一条边的两个端点。每行中的数字之间用1空格分隔。输出格式:...原创 2019-06-02 17:05:18 · 97 阅读 · 0 评论