- 博客(9)
- 收藏
- 关注
原创 链表
链表是通过指针连接,将数据存储的⼀一种⽅方式. 英⽂文为list,在stl当中,也有list这个函数库,函数的具体⽤用法请参考 https://blog.youkuaiyun.com/zhouzhenhe2008/article/details/77428743/ typedef struct node{ int data; struct node *next; }node;// 结...
2018-08-14 15:56:42
204
原创 数与二叉树
一.树的递归定义 树(tree)是n(n>0)个结点的有限集,满足: (1)有且仅有一个特定的称为根(root)的结点; (2)其余的结点可分为m(m≥0)个互不相交的有限集,其中每个集合本身又是一棵树,并称其为根的子树(subtree)。 •树是一种递归的数据结构 •树的递归定义既道出了树的固有特性又为树的递归处理带来很大的方便。 二.树的表示方法 ...
2018-08-14 15:50:26
251
原创 回溯法-BFS(Breadth first search)
细胞有几个 #include<iostream> #include<cstring> #include<queue> using namespace std; const int N = 100+5; int dx[]={0,0,1,-1}; int dy[]={1,-1,0,0}; bool bz[N][N]; int num=0; int m,n; st...
2018-08-06 18:54:25
335
原创 全排列-回溯算法-dfs(depth first search)
全排列问题 #include <iostream> #include <cstring> using namespace std; const int N=10+5; //最多10个数的全排列 int n; //n个数的全排列 int a[N]; //N个盒子,编号为1-n bool used[N]; //标记n张牌是不是在手中,在手中就是false,不在...
2018-08-06 18:46:23
550
原创 问题 B: 括弧匹配检验
题目描述 假设表达式中允许包含两种括号:圆括号和方括号,其嵌套的顺序随意,如([]())或[([][])]等为正确的匹配,[(])或([]()或(()))均为错误的匹配。 现在的问题是,要求检验一个给定表达式中的括弧是否正确匹配? 输入一个只包含圆括号和方括号的字符串,判断字符串中的括号是否匹配,匹配就输出 “OK”,不匹配就输出“Wrong”。 输入一个字符串:[([...
2018-07-30 20:18:00
559
原创 问题 A: 【数组】准确计算自然数N的阶乘(N≤50)
题目描述 对于自然数N的阶乘,当N比较小时,可以32位整数int范围内准确表示 例如12!=479001600<2147483647(231-1) 而20!=2432902008176640000<9223372036854775807(263-1)可以在64位整数long long int范围内准确表示 但是N取值更大时,N!只能使用浮点数计算,从而产生误差 要求:输入自然数N(N≤5...
2018-07-30 20:16:13
1082
原创 The Blocks Problem UVA101
#include<cstdio> #include<string> #include<vector> #include<iostream> using namespace std; const int maxn = 30; int n; vector<int> pile[maxn]; void find_block(int a,int ...
2018-07-30 20:14:22
312
原创 UVA -刽子手游戏 —489
In “Hangman Judge,” you are to write a program that judges a series of Hangman games. For each game, the answer to the puzzle is given as well as the guesses. Rules are the same as the classic game o...
2018-07-23 10:35:07
302
原创 UVA-Puzzle
https://cn.vjudge.net/contest/239026#problem/A A children’s puzzle that was popular 30 years ago consisted of a 5×5 frame which contained 24 small squares of equal size. A unique letter of the alphab...
2018-07-23 10:26:24
255
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅