自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

_

_TIME

  • 博客(23)
  • 收藏
  • 关注

原创 简单有序表【C语言程序设计】

一.实验目的:1.掌握指针与内存地址的关系2.掌握通过指针动态申请和释放内存的编程方法3.学习和掌握单向链表的基本操作 二、实验内容和步骤1.分析并修改下面程序错误,使之能够正常运行。错误代码一:输入若干学生的信息(学号、姓名、成绩),当输入学号为 0 时结束,用单向链表组织这些学生信息后,再按序输出。#include

2017-10-31 16:32:54 3376

原创 结构体【C语言程序设计】

一.实验目的:1.学习掌握结构化数据的编程使用二、实验内容和步骤1.分析并修改下面程序错误,使之能够正常运行。错误代码一:程序实现输出图书的名字和单价,错误代码如下:#include  struct book{     float price;//价格     char name[10];//名字}int

2017-10-31 16:30:33 4296

原创 指针【C语言程序设计】

一.实验目的:1.掌握变量的指针使用方法2.掌握通过指针传递数组的方法3.  掌握指针与数组和函数编程的应用方法4.学习和掌握基本的递归的程序设计方法 二、实验内容和步骤1.分析并修改下面程序错误,使之能够正常运行。错误代码一:程序实现:将字符串 s 连接到t 的后面。如输入 Birthday 和 Happy ,则程序输出

2017-10-31 16:26:42 3686 1

原创 模块化【C语言程序设计】

一.实验目的: 二、实验内容和步骤(1)分析并修改下面程序错误,使之能够正常运行。错误代码一:输入两个数,输出其中较大的数,错误代码如下:int  max(int a, b);{    if(a>b)     max=a;   else     max=b; return max;}int  mai

2017-10-31 16:24:28 4576 1

原创 有序数据【C语言程序设计】

一.实验目的:1.掌握数组的定义、赋值和输入输出方法2.学习使用数组实现相关算法二、实验内容和步骤1.分析并修改下面程序错误,使之能够正常运行。错误代码一:该程序统计数组元素之和并输出。#include  int main(void){  inta[5]={5,4,3,2,1};  inti;  for(i

2017-10-31 16:22:04 2974 2

原创 循环结构【C语言程序设计】

一.实验目的:1. 学习和掌握二重循环结构编程;2. 学习和使用基础算法--枚举算法 二、实验内容和步骤1)   编写程序,打印99乘法表代码: #include void main(){  inti,j; for(i=1;i  {              for(j=1;j         

2017-10-31 16:17:49 3303

原创 选择结构【C语言程序设计】

一.实验目的:1. 正确使用关系表达式和逻辑表达式表示条件;2. 掌握选择语句if-else和switch语句的使用方法;3. 掌握分支结构程序设计。 二、实验内容和步骤 (1)分析并修改下面程序错误,使之能够正常运行。错误代码一:下面的这个程序是当a和b的值相等的情况下输出“a和b相等”,而a与b的值不相等的话无输出。#include ...

2017-10-31 16:13:03 3932

原创 算术中缀表达式求值(栈实现)

问题描述:输入由整型分量和操作符组成的中缀表达式,输出其后缀表达式和运算的结果。整型分量:十进制数。操作符:( , ) , + , - , * , / 。如输入3*(5-8/2)+7,输出 3 5 8 2 / - * 7 +,结果是10;输入3-(1/4+7)*3 ,输出 3 1 4 / 7 + 3 * -,结果是 -18.75;输入3*4/5*(5-7)+4,输出 3 4 * 5 / 5 7 -...

2017-10-29 10:29:00 20937 3

原创 迷宫问题【数据结构实验报告】

数据结构实验报告实验名称:实验二 迷宫问题学号:***姓名:gnosed实验日期:2017.10.23 一、实验目的1、了解回溯法在求解迷宫问题中的应用2、进一步掌握栈的使用 二、实验具体内容1、实验题目1:(1)题目用回溯法求解迷宫问题,可以用一个栈保存探索的序列。并且在该迷宫的行走中,站在一点可以有八个方向选择。比如如下的迷宫Ente...

2017-10-27 12:31:01 31846 3

原创 多项式相加减【数据结构实验报告】

注意:Code://head file: "Poly.h"#ifndef POLY_H_INCLUDED#define POLY_H_INCLUDEDstruct Polynode{ double cof; int exp; struct Polynode* next;};typedef struct Polynode* plist;

2017-10-20 02:01:11 5950

原创 UVA 210 Concurrency Simulator(deque,queue,模拟)

Programs executed concurrently on a uniprocessor system appear to be executed at the same time, butin reality the single CPU alternates between the programs, executing some number of instructions fr

2017-10-15 18:17:17 238

原创 UVA 12504 Updatig a Dictionary(map)

In this problem, a dictionary is collection of key-value pairs, where keys are lower-case letters, and values are non-negative integers. Given an old dictionary and a new dictionary, find out what wer

2017-10-11 22:36:10 248

原创 UVA 230 Borrowers(多种STL运用)

详细题目:https://vjudge.net/problem/UVA-230思路:根据题意先对各本书进行排序(按ASCII码先作者后书名),建立一个结构体 book 对每本书的作者和状态(入藏,借出,归还但未上架)进行储存,并通过建立 map 的键值关系。对于每次 SHELVE 操作,找到第三种状态的书,确定其插入的位置(先前排序的作用于此)。代码:#include #incl

2017-10-08 16:55:45 283

原创 UVA 12100 Printer Queue(队列,优先队列)

详细题目:https://vjudge.net/problem/UVA-12100思路:用队列模拟,开一个 的队列,分别表示任务的优先级和位置。再开一个 的优先队列,默认任务的优先级为从大到小的优先顺序。每次取出队列首任务,若其优先级不是最高的(根据优先队列判断),将其入队;否则,ans++,再判断其位置是否为所求任务完成的时刻,若是则输出ans结束。#inclu

2017-10-06 22:33:23 320

原创 UVA 1595 Symmetry(暴力)

The figure shown on the left is left-right symmetric as it is possible to fold the sheet of paper along a vertical line, drawn as a dashed line, and to cut the figure into two identical halves. The fi

2017-10-06 16:33:07 264

原创 UVA 10391 Compound Words

You are to find all the two-word compound words in a dictionary. A two-word compound word is a word in the dictionary that is theconcatenation of exactly two other words in the dictionary.Input

2017-10-06 16:08:33 251

原创 二叉树非递归深度优先DFS算法

二叉树可以递归遍历,实现简洁,易于理解。这里介绍二叉树的非递归的三种遍历,以下图二叉树为例讲解。先前声明#define ELEMENTTYPE chartypedef struct node* pnode;typedef struct node* PBintree;struct node{ ELEMENTTYPE n; pnode lchild; pn...

2017-10-06 10:58:14 2358

原创 UVA 10763 Foreign Exchange

思路:每一个想从A学校换到B学校的学生必须找到一个唯一的从B学校换到A学校的学生。可以定义一个arr[ ]数组作为AB的关系,并对每一对关系进行swap(arr[a],arr[b]),如果交换成功,最后的对于每一个 i,必有arr[ i ]= i。#include #include #include using namespace std;const int maxn=5000

2017-10-05 21:38:50 244

原创 UVA 10935 Throwing cards away I (queue)

Given is an ordered deck of n cards numbered 1 to n with card 1 at the top and card n at the bottom. The following operation is performed as long as there are at least two cards in the deck:  Throw

2017-10-05 19:30:23 269

原创 KMP匹配算法源码

模式匹配问题,即字符串的匹配,int index(String t,String p),求p在t中第一次出现的位置。如何高效地匹配?先来讨论朴素的回溯的模式匹配。例如,设t=“abbaba”,p=“aba”,p的长度为6(plen=6),t的长度为3(tlen=3)。匹配过程如下:算法如下:int index(string p, string t){...

2017-10-04 11:57:49 381

原创 UVA 1594 Ducci Sequence

思路:开个新的数组来保存Ducci 序列,每次abs后,作判断。只有两种LOOP或ZERO结果,只需判断一项。#include #include #include using namespace std;bool zeo_jud(int *a,int len){ for(int i=0;i<len;i++) { if(a[i]!=0)

2017-10-03 17:29:28 208

原创 UVA 1593 Alignment of Code

You are working in a team that writes Incredibly Customizable Programming Codewriter (ICPC) which is basically a text editor with bells and whistles. You are working on a module that takes a piece of

2017-10-03 13:40:35 246

原创 UVA 221 Urban Elevations (离散化)

An elevation of a collection of buildings is an orthogonal projection of the buildings onto a vertical plane. An external elevation of a city would show the skyline and the faces of the ``visible" bui

2017-10-03 12:15:06 345

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除