C语言
千秋不知岁
这个作者很懒,什么都没留下…
展开
-
链表中下一个更大节点
链表中下一个更大节点 #include<stdio.h> #include<stdlib.h> typedef int elemtype; typedef struct _node{ elemtype data; //加一个节点下标 int idx; struct _node *next; }Node; typedef struct { Node *hea...原创 2019-12-24 20:00:02 · 224 阅读 · 0 评论 -
每日温度
每日温度 #include<stdio.h> #include<stdlib.h> typedef int elemtype; typedef struct { elemtype a[20]; elemtype idx[20]; //记录下标 int top; }Stack; Stack* InitStack() { Stack *s=(Stack *)m...原创 2019-12-23 16:38:27 · 155 阅读 · 0 评论 -
最小栈
最小栈 #include<stdio.h> #include<stdlib.h> #define MAX 30 typedef int elemtype; typedef struct { elemtype a[30]; int top; }Stack; Stack* InitStack() { Stack *s=(Stack *)malloc(sizeof(S...原创 2019-12-18 18:57:45 · 87 阅读 · 0 评论 -
队列
队列 #include<stdio.h> #include<stdlib.h> typedef char elemtype; typedef struct _queue{ elemtype data; struct _queue *next; }Queue; typedef struct{ Queue *front; Queue *rear; }LinkQueue...原创 2019-12-17 20:32:53 · 84 阅读 · 0 评论 -
螺旋矩阵
##螺旋矩阵 #include<stdio.h> #include<stdbool.h> int main() { int n; scanf("%d",&n); int a[n][n]; int i=0; int j=0; int s=1; for(i=0;i<n;i++) for(j=0;j<n;j++) a[i][j]=0;...原创 2019-12-13 17:24:15 · 99 阅读 · 0 评论 -
股票问题
股票问题 题目描述:给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。 设计一个算法来计算你所能获取的最大利润。你可以尽可能地完成更多的交易(多次买卖一支股票)。 注意:你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。 来源:力扣(LeetCode) #include<stdio.h> #include<stdlib.h> int main() ...原创 2019-12-11 15:44:09 · 119 阅读 · 0 评论 -
大数相乘
大数相乘 #include<stdio.h> #define N 1000 int mylen(char *a) { int i=0; while(a[i]!='\0') { i++; } return i; } int main() { char a[N]; char b[N]; int num_1[N]; int num_2[N]; int sum[N...原创 2019-12-08 19:54:02 · 74 阅读 · 0 评论 -
泰波那契数列-大数相加
泰波那契数列-大数相加 #include<stdio.h> #define N 1000 int main() { int a[N]={0}; //泰波那契数列前三个 0,1,1 int b[N]={1}; int c[N]={1}; int t[N]={0}; int i,n; scanf("%d",&n); int j; int g=0; int ...原创 2019-12-06 15:11:02 · 234 阅读 · 0 评论 -
链表的选择排序
链表的选择排序 #include<stdio.h> #include<stdlib.h> #include<stdbool.h> typedef struct _node{ int number; struct _node *next; }Node; typedef struct{ Node *head; Node *tail; }List; vo...原创 2019-12-05 15:12:13 · 131 阅读 · 0 评论 -
将链表逆置
将链表逆置 #include<stdio.h> #include<stdlib.h> #include<stdbool.h> typedef struct _node{ int number; struct _node *next; }Node; typedef struct { Node *head; Node *tail; }List; vo...原创 2019-12-04 15:50:19 · 207 阅读 · 0 评论 -
将两个有序链表合并成一个有序链表
将两个有序链表合并成一个有序链表 #include<stdio.h> #include<stdlib.h> #include<stdbool.h> typedef struct _node{ int number; struct _node *next; }Node; typedef struct{ Node *head; Node *tail; }L...原创 2019-12-03 16:44:16 · 1136 阅读 · 0 评论 -
归并排序
归并排序 #include<stdio.h> void Sort_Message(int *a,int *teamp,int start,int end); void Merge_Sort(int *a,int *teamp,int start,int mid,int end); int main() { int a[9]={3,23,54,1,564,23,1,0,65}; ...原创 2019-12-01 11:27:49 · 65 阅读 · 0 评论 -
在指定位置插入和删除节点
在指定位置插入和删除节点 #include<stdio.h> #include<stdlib.h> #include<stdbool.h> typedef struct _node{ int number; struct _node *next; }Node; typedef struct{ Node *head; Node *tail; }List;...原创 2019-11-30 10:34:51 · 826 阅读 · 0 评论 -
链表-删除
链表-删除 #include<stdio.h> #include<stdlib.h> typedef struct _node{ int num; struct _node *next; }Node; typedef struct{ Node *head; Node *tail; }List; void add(List *plist); void...原创 2019-11-29 15:50:34 · 137 阅读 · 0 评论 -
链表-结构体list
链表-结构体list #include<stdio.h> #include<stdlib.h> typedef struct node{ int num struct node *next; //指向 struct node 类型的指针 }Node; typedef struct _list{ Node *head; //用list结构来在函数中...原创 2019-11-24 17:25:48 · 669 阅读 · 0 评论 -
取石子
取石子 #include<stdio.h> int main() { int num,m,i=0; scanf("%d %d",&num,&m); if(num%(m+1)==0) { printf("lose"); } else { printf("win "); while((num%(m+1)+(m+1)*i)<=num) ...原创 2019-11-23 08:41:46 · 105 阅读 · 0 评论 -
mylen()
sda原创 2019-11-23 08:36:28 · 429 阅读 · 0 评论 -
结构体数组-getstruct()与putstruct()
结构体-getstruct() #include<stdio.h> typedef struct point{ int x; int y; }PI; //起别名PI void getstruct(PI *p); //设置一个输入与输出函数 void putstruct(PI *P); int main() { PI p1; getstruct(&p1...原创 2019-11-22 20:44:39 · 1233 阅读 · 0 评论