- 博客(16)
- 资源 (3)
- 收藏
- 关注
原创 python学习笔记
1、python的变量定义规则同C语言 2、打印:print() 3、字符串: 1.用双引号或者单引号 2.用 + 号来连接字符串 3.字符串的引号中使用\n换行,\t空格 有用的函数 name.upper() 转换为大写 name.lower() 转换为小写 name.title() 首字母大写 message1.rstrip()删除字符串后面的多余空格(临时,要删除需要保) message2.lstrip()删除字符串前面的多余空格(临时,存至一个字符串中) mess
2021-01-25 20:43:45
150
原创 2020—6 岛屿周长和面积
递归求DEM的岛屿周长或者面积 #include<stdio.h> #include<stdlib.h> #include<string.h> int getarea(int a[10][10],int i,int j) { if(i<0||i>=10||j<0||j>=10) return 0; else if(a[i][j]>0) { a[i][j]=0; return getarea(a,i-1,j)+getare
2020-12-14 21:50:44
136
原创 拓展——递归删除单链表中所有值为x的结点
#include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct LNode { int data; struct LNode *next; }LNode; LNode *create(int n) { LNode *L=(LNode*)malloc(sizeof(LNode)); LNode *s=NULL,*p=L; int i,j; for(i=0;i<n;i++) {
2020-12-11 18:31:37
465
原创 模拟C——7
#include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct { int in; int info; }Vertextype; typedef struct { float edges[50][50]; int n,e; Vertextype vex[50]; }MGraph; MGraph create() { int i,j; MGraph G; G.n=7; G.e
2020-12-10 21:10:15
138
原创 2020—4 线性复杂度求第K大的数
本题可以使用桶排序、基数排序、计数排序(我个人比较喜欢计数排序) 下面的方法是基于快速排序(比较复杂,但是漏洞最少) #include<stdio.h> #include<stdlib.h> #include<string.h> int quicksort(int s[],int l,int r) { int i,j,x; if(l<r) { i=l; j=r; x=s[i]; while(i<j) { while(i<
2020-12-09 20:51:56
137
原创 2017—6 求最长对称子串
#include<stdio.h> #include<stdlib.h> #include<string.h> int findmax(char *str) { int i,m,n,maxlen=1,s; for(i=1; i<strlen(str); i++) { s=1; //对称字符串长度为奇数的情况 m=i-1; n=i+1; while( m>=0 && n<strlen(
2020-12-03 00:08:13
146
原创 模拟——哈希表(除留余数法+链地址法)
#include<stdio.h> #include<stdlib.h> #include<string.h> #define maxsize 13 typedef struct LNode { int data; struct LNode *next; }LNode; typedef struct { int length; LNode *list[20]; }HashTable; int Hash(int key) { return key%maxsi
2020-11-29 22:55:36
681
1
原创 2014—5 分解质因数
分解质因数(递归与非递归的方法) #include<stdio.h> #include<stdlib.h> int data[20],j=0; int prim(int n) { int i; for(i=2;i*i<=n;i++) { if(n%i==0) return 0; } return 1; } void f(int n,int i) { if(i>n) //注意条件 return; else { if(prim(i)
2020-11-27 22:34:02
355
原创 2008—7 单词词频
计算一行字符中单词的词频 其中计算词频用二叉树计算 2008年最后一题(有几个注意点) #include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct BTnode { //char *ch; char ch[20]; int count; struct BTnode *lchild,*rchild; }BTnode; void insert(BTnode **p,char *s)
2020-11-20 22:22:23
80
原创 文件合并——几个注意点
有两个磁盘文件,各存放一行字母,要求把这两个文件中的信息合并,按照字母顺序排列,输出到文件C #include<stdio.h> #include<stdlib.h> int main() { FILE *fp1,*fp2,*fp3; char s[100],temp,ch; int i,j; if((fp1=fopen("D:\\A.txt","r"))==NULL) //双引号 { printf("error!\n"); exit(0); } if((f
2020-11-19 20:45:46
207
原创 N皇后问题
#include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> typedef struct { int x,y; }Location; int t=0; int check(int i,Location c[]) { int j; for(j=0;j<c[i].x;j++) { if( (c[i].x==c[j].x) ||c[i].y==c[j].y |
2020-11-09 16:28:22
88
原创 单词计数问题
#include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> typedef struct { char a[20]; int count; }words; int check(char c) { if((c>='a'&&c<='z')||(c>='A'&&c<='Z')) return 1; else
2020-11-09 16:27:51
117
原创 地图着色
求解可以有多少种不同的解法(回溯法、递归) #include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> int count=0; typedef struct ArcNode//边表结点 { int adjvex;//邻接点域,存储该顶点对应的下标 struct ArcNode *nextarc; //链域,指向下一个邻接点 } ArcNode; typed
2020-11-09 16:25:41
299
原创 二级指针(链表建立、打印)
#include<stdio.h> #include<stdlib.h> typedef struct LNode { int data; struct LNode *next; }LNode; void insert(LNode *A,int i) { LNode *p; p=(LNode*)malloc(sizeof(LNode)); p->data=i; p->next=A->next; A->next=p; } /* void Sql
2020-11-09 16:24:30
190
原创 二叉树建立、打印、求高度
#include<stdio.h> #include<stdlib.h> typedef struct BTree { char data; struct BTree *child; struct BTree *brother; }BTree; typedef struct { BTree *p; int level; }st; void print(BTree *p) { if(p!=NULL) { printf("%c\n",p->data);
2020-11-09 16:22:53
175
原创 前缀求值+后缀转前缀
前缀求值+后缀转前缀 #include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> char *chartostr(char c) { char *s; s=(char *)malloc(sizeof(char)*2); if(s==NULL) return NULL; s[0]=c; s[1]=’\0’; return s; } char *change(char *c) {
2020-11-09 16:19:48
98
利用C语言和matlab计算GPS卫星坐标和基线长度
2020-06-13
GPS电离层延迟修正、伪距差分、载波相位单点定位计算整周模糊度、精密星历插值
2021-06-29
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人