随笔分类 -  C语言

摘要:#include <iostream>#include <stdlib.h>using namespace std;struct node{ int x; //号码 int data; //密码 struct node * next; //下一个节点};typedef struct node *Li 阅读全文
posted @ 2020-10-06 19:15 嘻嘻嘻ziixi 阅读(211) 评论(0) 推荐(0)
摘要:#include <iostream> using namespace std; const int N = 60; long long dp[N]; int n; void show(){ dp[0]=0;dp[1]=1; dp[2]=2;dp[3]=3;dp[4]=4; for(int i=5; 阅读全文
posted @ 2020-09-02 22:39 嘻嘻嘻ziixi 阅读(183) 评论(0) 推荐(0)
摘要:C++ 中的sort排序用法 C中的qsort()采用的是快排算法,C++的sort()则是改进的快排算法。两者的时间复杂度都是n*(logn),但是实际应用中,sort()一般要快些,建议使用sort()。 STL中自带了快速排序,对给定区间进行排序,包含在头文件<algorithm>中 ,语法描 阅读全文
posted @ 2020-07-17 17:54 嘻嘻嘻ziixi 阅读(939) 评论(0) 推荐(0)
摘要:#include <iostream> #include <algorithm> using namespace std; struct stu{ char name[20]; int ar; }; bool map(struct stu a,struct stu b){ if(a.ar<b.ar) 阅读全文
posted @ 2020-07-15 20:48 嘻嘻嘻ziixi 阅读(197) 评论(0) 推荐(0)
摘要:两个整数做除法,有时会产生循环小数,其循环部分称为:循环节。 比如,11/13=0.846153846153…11/13=0.846153846153\ldots11/13=0.846153846153… 其循环节为846153共有 6位 int m(int n,int m){ vector<int 阅读全文
posted @ 2020-07-13 11:25 嘻嘻嘻ziixi 阅读(1340) 评论(0) 推荐(0)
摘要:int change(int x, int ch){ int tmp = x; int bit[10] = {0}; char everybit[5] = {'A', 'B', 'C', 'D', 'E'}; int count = 0; while(tmp != 0) // 辗转相除法求对应进制 阅读全文
posted @ 2020-06-28 19:11 嘻嘻嘻ziixi 阅读(146) 评论(0) 推荐(0)
摘要:#include <stdio.h>#include <stdlib.h>#include <string.h>#include <stdbool.h>#include <iostream>#include <algorithm>using namespace std;#define N 300st 阅读全文
posted @ 2020-06-28 14:51 嘻嘻嘻ziixi 阅读(128) 评论(0) 推荐(0)
摘要:#include <iostream>#include <algorithm>#include <cstdio>using namespace std;#define MAX 10000int main(){ int n,m; scanf("%d %d",&n,&m); int wen[MAX],t 阅读全文
posted @ 2020-04-21 17:19 嘻嘻嘻ziixi 阅读(169) 评论(0) 推荐(0)
摘要:#include <iostream>#include <cstdio>using namespace std;int main(){ int n,m; cin>>n>>m; char z='A';for(int i=1;i<=n;i++){ for(int j=i;j>=1;j--){ print 阅读全文
posted @ 2020-03-31 17:22 嘻嘻嘻ziixi 阅读(128) 评论(0) 推荐(0)