shellsort&quiksort

#include<stdio.h>#include<stdlib.h>#include<time.h>int length;int j=1;//快速排序的趟数;void clear(){ char ch; do{ch=getchar();} while(ch!='\n');}//////////////////////////////////////////////////////////////////////////////int Partition(int *r, int low, int high){ //printf("第%d趟排序初始位置low:%...

使用队求解迷宫最短路径

#include <stdio.h>#include <stdlib.h>#define MAXQSIZE 64#define INCREMENT 16typedef struct node1{ int x; int y;} seat;typedef struct node2{ int pre; seat pos;} quequetype;typedef struct node3{ quequetype *base; int front; int rear; int size;} Queueptr;char maze[1000][1000]...

使用栈求解迷宫

#include<stdio.h>#include<time.h>#include<stdlib.h>#define DOWN 1#define LEFT 2#define UP 3#define RIGHT 4#define INITSTACKSIZE 100#define INCREMENTSIZE 10#define MARK 5#define BLIND_ALLEY 6typedef int ** MazeType;MazeType Maze;int Maze_Line,Maze_Column;typedef struct{ int x; int...

学生作业管理系统

#include <stdio.h>#include <stdlib.h>#include <io.h>typedef struct student{ char name[10]; int schoolnumber; int classnumber; float score[10]; struct student *next;} stu,*stupt;stupt st=NULL;//学生信息的头指针stupt qt=NULL;//学生信息的尾指针FILE* fp;//文件指针////////////////////////////////////////...

有关ubuntu开机提示setting sensors limits failed

网上说:You'll have to apt-get install lm_sensors or apt-get install lm-sensors ( LM_SENSORS or LM-SENSORS all lower ) and run the detection script.But some boards have really cheapo or proprietary sensor chips on them that aren't supported.接下来是我电脑的设置情况:xuweihai@xuweihai-Compaq-510:~$ sudo sensors-de...
ubuntu | 2011-06-30 17:31 | 阅读 1517 次 | 评论 0 条

借助栈实现单链表逆置

#include <stdio.h>#include <string.h>#include <stdlib.h>#include <malloc.h>typedef struct node{ char name[10]; char number[15]; char sex[5]; char age[5]; char _class[5]; char health[10]; struct node *next; }link,*linkptr;typedef struct lin{ linkptr base; linkptr top; //linkptr last;}...

链表上的基本操作实现

#include<stdio.h>#include<string.h>#include<stdlib.h>typedef struct node{ int data; struct node *next; }link,*linkptr;void creatlink(linkptr &amp;la,int n){ linkptr q1,q2; int i; for(i=0;i<n;i++) { q1=(linkptr)malloc(sizeof(link)); if(!q1)printf("error"); ...

患者到医院看病事件模拟

#include<stdio.h>#include<stdlib.h>#include<string.h>#include<malloc.h>typedef struct node{char number[20];struct node *next;}node,*queueptr;typedef struct{queueptr front;queueptr rear;}linkque;void initque(linkque &amp;q){ q.front=q.rear=(queueptr)malloc(sizeof(node)); q.front->next=NU...

学生信息管理

#include <stdio.h>#include <stdlib.h>struct student{ char number[20]; char name[10]; float score1; float score2; float score3; float average; struct student *next;}node;typedef struct student jie;void view(jie *q,int num){ printf("%s %s %.2f %.2f %.2f %.2f %d\n",q->numbe...

括号匹配问题

标题: 括号匹配问题 时 限: 1000 ms 内存限制: 10000 K 总时限: 3000 ms 描述: 用顺序存储实现栈的初始化、入栈、出栈、取栈顶、判栈空操作。调用以上操作实现判断从键盘输入的括号序列是否匹配。 输入: 括号序列#(#为括号输入结束符号) 输出: 匹配或不匹配 输入样例: {[()]}# [{{}[(])}]# 输出样例: 匹配 不匹配 标题: 括号匹配问题 时 限: 1000 ms 内存限制: 10000 K 总时限: 3000 ...

约瑟夫环

#include <stdio.h>#include <stdlib.h>struct student{ char name[64]; char number[32]; char sex[16]; int age; char Class[64]; char health[64]; struct student *next;}node;typedef struct student jie;void view(jie *q1){ printf("%s ",q1->name); printf("%s ",q1->number); ...
默认分类 | 2011-06-15 13:09 | 阅读 840 次 | 评论 0 条

顺序表上的基本操作实现

标题: 顺序表上的基本操作实现 时 限: 1000 ms 内存限制: 10000 K 总时限: 1000 ms 描述: 在顺序存储结构实现基本操作:初始化、创建、插入、删除、查找、遍历、逆置、合并运算。 输入: 输入线性表La的长度:n输入线性表La中的元素:a1 a2 a3 ...an(数值有序,为降序)输入要插入到线性表La中的元素x和插入的位置i:x i输入要删除元素的位置:i输入要查找的元素:x输入线性表Lb的长度:m输入线性表Lb中的元素:b1 b2...bm(数值有序,为升序) 输出: 创建好的线性表La=...
默认分类 | 2011-06-15 13:06 | 阅读 1017 次 | 评论 0 条

n*n阶矩阵转置

#include <stdio.h>#include <stdlib.h>#define SIZE 3int** get_army(int **q);void change(int **p);void output(int **p);int main(){ int **p, **q,i; q=(int **)malloc(sizeof(int *)*SIZE);//分配行指针 for(i=0; i<SIZE; i++) q[i]=(int *)malloc(sizeof(int)*SIZE);//为每行分配内存 p=get_army(q); ...
默认分类 | 2011-06-13 23:21 | 阅读 1121 次 | 评论 0 条

按顺序方式存储的一棵完全二叉树,先序,中序和后序遍历结果

标题: 由顺序方式存储的完全二叉树进行重建 时 限: 1000 ms 内存限制: 3000 K 总时限: 3000 ms 描述: 按顺序方式存储的一棵完全二叉树的结点记录,结点个数为n。根据所输入的顺序结构的结点记录建立二叉树,输出树的先序,中序和后序遍历结果。 注:数字“0”表示不存在此结点,没有孩子结点 输入: 树结点个数n 顺序方式存储的完全二叉树 输出: 先序遍历输出 中序遍历输出 后序遍历输出 输入样例: 10 1 2 0 3 4 0 0 5 6 7 输出样例: 1 2 3 5 6 4 7 ...
默认分类 | 2011-05-24 18:59 | 阅读 1955 次 | 评论 0 条

二叉树的创建和打印、。。。

#include <stdio.h>#include <malloc.h>typedef struct BitNode{ struct BitNode *lchild, *rchild; int level; char data;}BitNode, *BiTree;char s[100];char *c = s;void get_str(){ int i=0; while( (s[i++] = getchar()) != '\n' );}int CreateBiTree_GList(BiTree &amp;T){ if (*c=='...
默认分类 | 2011-04-21 13:30 | 阅读 942 次 | 评论 0 条

输入三个字符串a,b和c,将a中b的第一次出现替换为c

字符串替换 时限:1000ms 内存限制:10000K 总时限:3000ms 描述: 输入三个字符串a,b和c,将a中b的第一次出现替换为c。 输入: 输入三行,每行一个字符串,字符串长度不超过255。 输出: 如果b有出现在a中,输出替换后的字符串。 输入样例: abcdefghcdeXiaolan 输出样例: abXiaolanfgh 提示: 所有字符串只包含英文字母。 #include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>int main(){ ch...
默认分类 | 2011-03-26 19:38 | 阅读 2208 次 | 评论 0 条

用指针实现字符统计

用指针实现字符统计 时限:1000ms 内存限制:10000K 总时限:3000ms 描述: 是用指针编程:输入一行文字,统计其中大写字母、小写字母、空格以及数字字符的个数。 输入: 一行字符。 输出: 大写字母、小写字母、空格以及数字字符的个数,每个数字占一行。 输入样例: GGatT 123 输出样例: 3213 #include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>int main(){ char a[100]; char *p; int u...
默认分类 | 2011-03-23 23:11 | 阅读 1208 次 | 评论 0 条

字符串逆序

#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>int main(){ char a[29]; int i=0;int j; char f; while((f=getchar())!='\n') { a[i]=f; i++; } for(j=i-1;j>=0;j--) { printf("%c",a[j]); } printf("\n"); return 0;}字符串逆序 ...
默认分类 | 2011-03-23 14:11 | 阅读 1142 次 | 评论 2 条

整除

整除 时限:1000ms 内存限制:10000K 总时限:3000ms 描述: 找出1~100之间能被7或11整除的所有整数,存放在数组a中,并统计个数。要求以每行5个数据的形式输出a数组中的数据。 输入: 无 输出: 数据的总长度,单独一行。以每行5个数据的形式输出a数组中的数据。(第5个数后无空格) 输入样例: 输出样例: 227 11 14 21 2228 33 35 42 4449 55 56 63 6670 77 84 88 9198 99 #include <stdio.h>#include <stdlib.h>#include <strin...
默认分类 | 2011-03-23 13:54 | 阅读 799 次 | 评论 0 条

字符统计

#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>int main(){ char a[3][80]; int i,j,upper,lower,num,blank,orther; upper=lower=num=blank=orther=0; for(i=0;i<3;i++) { for(j=0;j<80;j++) { scanf("%c",&amp;a[i][j]); } //gets(a[i]); } for(i=...
默认分类 | 2011-03-23 13:35 | 阅读 815 次 | 评论 0 条
浏览66698次