自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

888666

As you see

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

原创 JavaSwing制作简单计算器

重点内容

2016-09-21 16:53:57 907

原创 二叉树的构建和三种遍历算法 (递归实现)

#include "stdio.h"#include "malloc.h"#define TRUE 1#define FALSE 0#define OK 1#define ERROR 0#define INFEASIBLE -1#define OVERFLOW -2typedef int Status;typedef char ElemType;typedef struc

2016-04-18 22:34:02 770

原创 快速排序

#include <stdio.h>#include <stdlib.h>void Quicksort ( int *a , int left ,int right,int len) { if ( left >= right ){ return ; } int i,j,k,key; key=a[left]; i=left; j=right; wh

2016-04-13 21:30:06 273

原创 朴素的模式匹配算法

子串的定位操作通常称做模式匹配,其中子串称做模式串,主串称做目标串,朴素的模式匹配算法即是模式匹配的一种算法,其优点是简单易懂,易于理解,某些应用场合效率较高。缺点是需要多次回溯,对于数据较大的文本文件而言效率极低。代码如下: 注意:为了便于理解,设两个字符串的下标从1开始,即下标为0的字符用空格代替不计,因此,两个串的实际长度是strlen-1;(数据结构中,串使用定长顺序存储结构),同时主串为

2016-04-11 20:33:28 3905 2

原创 循环队列

/*循环队列2016年4月3日10:57:04*/#include<malloc.h>#include<stdio.h>#define MAXQSIZE 10typedef int Status;#define OK 1#define ERROR 0typedef int QElemType;//-----------------------typedef struct{

2016-04-03 10:58:17 310

原创 单链队列的基本操作实现

#include <stdio.h>#include <stdlib.h>#include <malloc.h>typedef struct Queue { int data; struct Queue * next;}Queue; //队列数据项的组成,数据部分和next指针typedef struct { struct Queue *front; st

2016-04-02 23:31:51 1376

原创 栈 行编辑程序

typedef char SElemType;#include"malloc.h"#include"stdio.h"#include"math.h"#include"stdlib.h" #define OK 1#define ERROR 0#define TRUE 1#define FALSE 0typedef int Status; // Status是函数的类型,其值是函数结果

2016-03-25 11:08:31 714

原创 栈 括号匹配程序

typedef char SElemType;#include"malloc.h"#include"stdio.h"#include"math.h"#include"stdlib.h" // exit()#define OK 1#define ERROR 0#define TRUE 1#define FALSE 0typedef int Status; // Status是函数的类

2016-03-25 00:08:08 333

原创 链表实现约瑟夫环

//实现算法---//准备:含有头结点的单链表,每个结点的数据域存储顺序;//思路:**使单链表的为尾结点连接首元结点 形成循环链表 然后每个M(代码中为3)个数字删除一位,循环至最后,只剩下一个结点就是结果**void game_Links(Linklist &L){ Linklist p,s; p=L->next; while(p->next!

2016-03-23 19:59:40 510

原创 栈的一些基本操作

#include<malloc.h>#include<stdio.h>#define OK 1#define ERROR 0#define STACK_INIT_SIZE 100 // 存储空间初始分配量#define STACKINCREMENT 10 // 存储空间分配增量typedef int SElemType; // 定义栈元素类型typedef int Status; //

2016-03-23 11:24:57 445

原创 链表的冒泡排序

struct DATA *sort(struct DATA *head) { struct DATA *q1,*q2; for (q1=head;q1!=NULL;q1=q1->next){ for (q2=head;q2!=NULL;q2=q2->next){ long temp; if (q1->num<=

2016-03-22 23:46:20 280

原创 单链表的逆序

Status ruturn_L(LinkList &L){ LinkList head,next,prev; prev=NULL; head=L->next; while (head!=NULL){ next=head->next; // head->next=prev;

2016-03-21 21:03:02 308

原创 有序链表的合并

#include<stdio.h>#include<malloc.h>#define ERROR 0#define OK 1#define ElemType inttypedef int Status;typedef struct LNode{ int data; struct LNode *next;}LNode,*LinkList;Status ListInsert_L(Lin

2016-03-21 14:00:40 420 1

原创 链表及其简单操作

#include<stdio.h>#include<malloc.h>#define ERROR 0#define OK 1#define ElemType inttypedef struct LNode{ int data; struct LNode *next;}LNode,*LinkList;int CreateLink_L(LinkList &L,int n){ Lin

2016-03-21 13:25:11 407

原创 链表按值大小插入和结点排序

struct student *insert (struct student *head, struct student *stud){ struct student *p,*q,*s; p=head; q=head->next; s=stud; while (q->num<s->num&&p!=NULL){ q=q->next;

2016-03-18 20:51:16 2512

原创 合并顺序表

//8557 输入格式 第一行:顺序表A的元素个数 第二行:顺序表A的各元素(非递减),用空格分开 第三行:顺序表B的元素个数 第四行:顺序表B的各元素(非递减),用空格分开 输出格式 第一行:顺序表A的元素列表 第二行:顺序表B的元素列表 第三行:合并后顺序表C的元素列表 输入样例 5 1 3 5 7 9 5 2 4 6 8 10 输出样例 List A:1 3 5

2016-03-18 10:46:45 505

原创 顺序线性表的实现

在C++的编译环境下运行(部分代码使用到 & 引用符, & 可以修改数据)// 准备//----------#include <iostream>#include <stdio.h>#include <malloc.h>using namespace std;//----------//status类型(int)返回值为函数结果代码,便与描述#define Status int#d

2016-03-17 11:12:54 274

原创 C-SCAUoj 输出不同的数

#include <stdio.h>#include <stdlib.h>int main(){ int a[10],i,j; for (i=0;i<10;i++) scanf("%d",&a[i]); for (i=0;i<10;i++) { for (j=0;j<i;j++) {

2016-03-15 23:45:21 466

原创 C-SCAUoj 删除字符串中的空格

#include <stdio.h>void removeSpace(char *s){ int i,j=0; for (i=0;s[i]!='\0';i++) { if(s[i]!=' ') s[j++]=s[i]; } s[j]='\0';}int main(){ char s[81]; gets(s); re

2016-03-15 23:02:48 353

原创 几种简单的排序

//冒泡排序for (i=0;i<len-1;i++) //排序的趟数 { for (j=0;j<len-1-i;j++) //len-1-i每次排序后,右边都固定了当前最值 { if (arr[j]>=arr[j+1]) { temp=arr[

2016-03-15 17:44:56 332

原创 三种循环 变量表达式的变化

//for 循环int main(){ int i; for (i=1;i<=5;i++) { printf("%d\n",i); } printf("循环结束后%d",i);}// 输出结果为 12345循环结束后6/**/易知 赋值给 i=1,执行完循环体后i+1

2016-03-14 22:42:21 438

原创 杭电oj 2027 统计元音

#include <stdio.h>int main(){ int n; char x,enter; scanf("%d%c",&n,&enter); while (n--) { int a=0,e=0,i=0,o=0,u=0; while (scanf("%c",&x)!=EOF&&

2016-03-13 23:45:04 339

原创 杭电oj 2043 密码

#include <stdio.h>int main(){ int n;char x,enter; scanf("%d%c",&n,&enter); while (n--) { int a=0,b=0,c=0,d=0,count=0; while (scanf("%c"

2016-03-13 23:23:09 351

原创 杭电oj 2039 三角形

#include <stdio.h>int main(){ int n; scanf("%d",&n); while ( n--) { double a,b,c; scanf("%lf%lf%lf",&a,&b,&c); if(a+b>

2016-03-13 23:03:38 602

原创 杭电oj 2019 数列有序

#include <stdio.h>int main(){ int a[100]={0},n,m,i,j; while (scanf("%d%d",&n,&m)!=EOF&&(n!=0||m!=0)) { for (i=0;i<n;i++) scanf("%d",&a[i]); int sign=0;

2016-03-13 22:51:31 533

原创 杭电oj 2020 绝对值排序

#include <stdio.h>#include <stdlib.h>int main(){ int n,a[101]={0}; while (scanf("%d",&n)!=EOF&&n!=0) { int i,j,temp; for (i=0;i<n;i++)

2016-03-13 20:02:57 436

原创 杭电oj 2018 母牛的故事

#include <stdio.h>int cow (int n){ if (n==1) return 1; if (n==2) return 2; if (n==3) return 3; return (cow(n-3)+cow(n-1));}int main(){ int n,sum; wh

2016-03-13 19:27:35 473

原创 杭电oj 2017 字符串的统计

#include <stdio.h>int main(){ int n; char c,enter; scanf("%d%c",&n,&enter); //enter 接受回车键 while (n--) { int

2016-03-13 18:41:34 515

原创 杭电oj 2014 评委会打分

#include <stdio.h>int main(){ int n; while (scanf("%d",&n)!=EOF) { int i,max,min; double sum,score; sum=0.0; scanf("%lf",&score); max=s

2016-03-13 14:59:29 527

原创 杭电oj 2013 蟠桃记

#include <stdio.h>int main(){ int n,sum; while (scanf("%d",&n)!=EOF) { // sum=2*(1+剩余) 从倒数第二天开始 sum=1; for (int i=2;i<=n;i++) sum=(sum+1)*2;

2016-03-13 14:31:17 431

原创 杭电oj 2012 素数判定

#include <stdio.h>int main(){ int x,y,i,j; while (scanf("%d%d",&x,&y)!=EOF&&(x!=0||y!=0)) { int g=0,flag=0; //每组数据进行初始化 for (i=x;i<=y;i++) { g=i*i+i+41; //n^

2016-03-13 13:13:38 446

原创 杭电oj 2011 多项式求和

#include <stdio.h>int main(){ int x,n,i,sign; double p,sum; scanf("%d",&x); while (x--) { scanf("%d",&n); sum=0.0; //初始化每一次计算 sign=1; for (i=1;i<=

2016-03-13 12:31:35 476

原创 杭电oj 2033 人见人爱A+B

#include <stdio.h>int main(){ int n,AH,AM,AS,BH,BM,BS; int sh=0,sm=0,ss=0; scanf("%d",&n); while (n--) { scanf("%d%d%d%d%d%d",

2016-03-12 21:50:01 373

原创 杭电oj 2032 杨辉三角

#include <stdio.h>int main(){ int a[30][30]={0},n,i,j; while (scanf("%d",&n)!=EOF) { // 杨辉三角 for (i=0;i<n;i++) {

2016-03-12 20:10:44 425

原创 杭电oj 2000 ASCⅡ码的排序

#include <stdio.h> int main(){ char a,b,c,enter,temp; // 注意回车字符的输入即可 while (scanf("%c%c%c%c",&a,&b,&c,&enter)!=EOF) { if (a>b) {temp=a;a=b;b=temp;} if (b>c

2016-03-12 13:13:48 319

原创 杭电oj 2001 计算两点间的距离

#include <stdio.h>#include <math.h>int main(){ float x1,y1,x2,y2; double d; while (scanf("%f%f%f%f",&x1,&y1,&x2,&y2)!=EOF) { d=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); pr

2016-03-11 11:14:22 244

原创 杭电oj 2008 数值统计

#include <stdio.h>int main(){ int n,a,b,c; float x; while (scanf("%d",&n)!=EOF&&n!=0) //N!=0 { a=b=c=0; while **(n--)** // { scan

2016-03-11 11:04:49 394

原创 杭电oj 1001 sum problem

#include <stdio.h>#include <stdlib.h>int main(){ int a,sum=0,i; while (scanf("%d",&a)!=EOF) { for (i=1;i<=a;i++) { sum=

2016-03-11 10:47:51 252

原创 杭电oj 2004 成绩转换

#include <stdio.h>int main(){ int t; while (scanf("%d",&t)!=EOF) { if(t>100||t<0) printf("Score is error!\n"); else if(t>=90&&t<=100)

2016-03-11 10:42:38 358

原创 杭电oj 2007 平方和和立方和

#include <stdio.h>int main(){ int x,y,s1,s2,i; while (scanf("%d%d",&x,&y)!=EOF) { s1=s2=0; if (x>y) { i=x;x=y;y=i;

2016-03-11 10:19:28 403

空空如也

空空如也

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

TA关注的人

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