- 博客(13)
- 收藏
- 关注
原创 数据结构实验一
编程预备 点击打开在线编译器,边学边练 两个必备的函数知识(其均来自于stdlib.h库中) Malloc函数 malloc()函数在堆中申请分配一个大小为size个字节的连续内存空间,若成功分配,则返回一个指向所分配空间起始地址的指针,否则返回空指针(NULL)。 2.Free函数 free()函数用来释放已分配的内存空间,参数p是待释放的内存空间的首指针。 总结来说malloc就是用来申请...
2019-10-29 19:44:15 559
原创 坐标排序
code: #include<iostream> #include<cstdio> #include<algorithm> #include<cstdlib> using namespace std; struct node { int a; int b; int c; }p[10000]; bool cmp(node x,node y) { i...
2019-10-15 23:16:47 1855
原创 快速排序
code: #include<iostream> #include<cstdio> #include<algorithm> using namespace std; int a[100055]; void qsort(int l,int r)//快排函数 { int i=l; int j=r; int x=a[(l+r)/2]; ...
2019-10-15 22:33:55 100
原创 插入排序
code: #include<iostream> #include<cstdio> #include<algorithm> using namespace std; int main(){ int a[100055]; int i,j,k; int n,head=1; cin>>n; for(i=1;i<=n;i++){ cin&...
2019-10-11 01:07:43 96
原创 飞奔的马
code: #include<iostream> #include<cstdio> #include<algorithm> using namespace std; //冒泡排序 int main(){ int i,j; int n,head=1; int a[100055]; int k,s; cin>>n; for(i=1;i...
2019-10-11 00:42:34 183
原创 冒泡排序
code: #include<iostream> #include<cstdio> #include<algorithm> using namespace std; //冒泡排序 int main(){ int i,j,k; int n,head=1; int a[100055]; cin>>n; for(i=1;i<=n;i+...
2019-10-11 00:27:10 83
原创 猜价模拟
code: #include<bits/stdc++.h> using namespace std; char str[100055]; int mark; bool ismid(){ return str[mark]=='y'; } bool bigger(){ if(str[mark]=='u') return false;//猜测的值<物品的值 if(str...
2019-10-10 23:41:45 157
原创 新生的入队仪式
code: #include<iostream> #include<cstdio> using namespace std; int a[100055]; int judge(int k){ if(k==1||k==2){ return k; }else return 0; } int main(){ long long m,n; int i,k,s,ma...
2019-10-10 23:39:02 182
原创 自动晾衣机
code: #include<iostream> #include<cstdio> using namespace std; int a[100055]; int main(){ int i,j,n; int m,temp; int current,position; scanf("%d",&n); while(cin>>m){ ...
2019-10-09 01:35:45 177
原创 疯狂的裁缝
code: #include<iostream> #include<cstdio> using namespace std; int a[100055]; int s[100055]; int main(){ int n,i; int l,r; int mins,ans; scanf("%d",&n); for(i=1;i<=n;i++){ ...
2019-10-09 01:04:21 673
原创 一元n次方程
code: #include<iostream> #include<cstdio> using namespace std; int main(){ int i,j,k; int temp,n; scanf("%d",&n); scanf("%d",&temp); if(temp!=1) printf("%d",temp); printf("x^%d"...
2019-10-09 00:12:20 1111
原创 电导流的矩形
code: #include<iostream> #include<cstdio> using namespace std; const int minint=-2147483647; int square[10005]; bool insquare[10005]; int lx[10005],ly[10005],rx[10005],ry[10005]; bool...
2019-10-08 22:46:25 133
原创 头疼的工人
题目描述 A市的工人们天天抱着脑袋,因为食品生产线上,他们用0和1来表示是否添加原料,而原料的种类,总计多达20种…… 更头疼的是,电路板上的数位,对于工人来说是一个不小的难题。电路板上的LED屏幕总是把0和1的数据,转化成一个十进制的数,于是每次,工人们就会天天计算12039这种数字的二进制位,这让工人们很头疼 对于一个数字x(0<x<1000000),我们想要将它化成简单二进制数相...
2019-10-07 23:55:22 103
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人