- 博客(7)
- 资源 (1)
- 收藏
- 关注
原创 算法笔记——化简分数
化简分数#include<cstdio>#include<algorithm>using namespace std;struct Fraction{ int down; int up;};int gcd(int a,int b){ if(b==0) return a; else{ return gcd(b,a%b); }}Fraction reduction(Fraction r){ if(r.down<0) { r.up=-r.up
2020-06-23 23:12:44
434
原创 算法笔记——数字黑洞
数字黑洞#include<cstdio>#include<algorithm>using namespace std;bool cmp(int a,int b){ return a>b;}void to_array(int n,int num[]){ for(int i=0;i<4;i++) { num[i]=n%10; n/=10; } }int to_number(int num[]){ int sum=0; for(int
2020-06-22 22:02:39
144
原创 C语言知识笔记1
字符串#include<cstdio>using namespace std;void fun(char *s){ while(*s) { *s=(*s-48+5)%10+48; printf("%d\n",*s); s++; }}int main(){ char a[]="0123456789"; fun(a); puts(a); }0的ASCII码为48,s指针指向a数组的首地址,传入fun()函数后,while(*p)中 *p为0,
2020-06-21 23:03:39
129
原创 算法笔记-活用递推
活用递推(基于two pointer)统计一串字符中出现了几次给定的单词比如:PAT:PAT出现了一次PATT:PAT出现了两次#include<cstdio>#include<string.h>using namespace std; int main() { char A[100]; char ch; int i=0; int ans=0; while((ch=getchar())!='\n') { A[i++]=ch;
2020-06-20 21:37:00
98
原创 算法笔记-快速排序
快速排序递归写法#include<cstdio>using namespace std;int partition(int A[],int left,int right){ int temp=A[left]; while(left<right) { while(left<right&&A[right]>temp) { right--; } A[left]=A[right]; while(left<right&am
2020-06-19 22:46:39
81
原创 算法笔记-合并排序
合并排序递归写法#include<cstdio>using namespace std;void merge(int a[],int L1,int R1,int L2,int R2){ int temp[100]; int n=L1; int m=L2; int i=0; while(n<=R1&&m<=R2) { if(a[n]<=a[m]){ temp[i++]=a[n]; n++; } else{ tem
2020-06-18 23:11:01
324
原创 算法笔记-木棒分割
算法笔记-木棒分割新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入#include<cstdio>#include<math.h>#include<algorithm>using
2020-06-17 23:45:08
241
静态与动态路由协议.ppt
2019-07-30
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人