2022年8月7日

贪心实践

摘要: 有 nn 根棍子,棍子 ii 的长度为 a_iai​。想要从中选出 33 根棍子组成周长尽可能长的三角形。 请输出最大的周长,若无法组成三角形则输出 00。 输入 第一行,一个整数 n(3 \leq n \leq 100)n(3≤n≤100),表示棍子数量 第二行 nn 个整数,表示每个棍子的长度  阅读全文

posted @ 2022-08-07 22:10 ewitt 阅读(18) 评论(0) 推荐(0) 编辑

2022年6月15日

CallBack回调函数工作机制

摘要: // // Created by tang on 2022/6/13. // #include <iostream> using namespace std; typedef int(*CallBack)(char *p);//声明CallBack 类型的函数指针 int A(char *p) { 阅读全文

posted @ 2022-06-15 08:28 ewitt 阅读(30) 评论(0) 推荐(0) 编辑

2021年9月16日

文字图片在wps中清晰化方法

摘要: 在wps中双击图片出属性,然后再选择文字增强。选择对比增加即可。 阅读全文

posted @ 2021-09-16 16:18 ewitt 阅读(4371) 评论(0) 推荐(0) 编辑

2021年6月30日

-std=c++11 编译器设置

摘要: range-based 'for' loops are not allowed in C++98 mode 阅读全文

posted @ 2021-06-30 22:25 ewitt 阅读(383) 评论(0) 推荐(0) 编辑

2021年6月9日

错题集的必要性

摘要: 任何一件事,只要有复杂性,那么就有容易犯错的地方,必须把它记录下来,不然会反复出错。 阅读全文

posted @ 2021-06-09 22:16 ewitt 阅读(162) 评论(0) 推荐(0) 编辑

2021年6月6日

从字符串某位置开始的递增串(dfs)注意for循环中下标的错误

摘要: #include <iostream> #include <string> using namespace std; char res[50];int tag=1; void dfs(int k,int len, int st,char str[]){//st为结果串的当前位置 if(k==len) 阅读全文

posted @ 2021-06-06 18:36 ewitt 阅读(40) 评论(0) 推荐(0) 编辑

2021年5月21日

并查集我知不道

摘要: #include <iostream> using namespace std; int set[10]; int find(int x)//找x的祖先 { if(set[x]==x) return x; return set[x]=find(set[x]);//把x的各个祖先的双亲都置最久远的祖先 阅读全文

posted @ 2021-05-21 09:05 ewitt 阅读(34) 评论(0) 推荐(0) 编辑

2021年5月17日

kmp-getNext

摘要: #include <iostream> using namespace std; void getNext(char a[]){ int k=-1,i=0,next[10]; next[0]=-1; while(a[i]!='\0'){ if(k 1 || a[i]==a[k]){ next[++i 阅读全文

posted @ 2021-05-17 10:05 ewitt 阅读(50) 评论(0) 推荐(0) 编辑

2021年5月15日

vector存放边的方法

摘要: #include<bits/stdc++.h> using namespace std; struct Edge{ int x; int y; }; vector <Edge> G; //G[i]代表从i出发的边,vector里存的是边 int m,n; int temp; int main(voi 阅读全文

posted @ 2021-05-15 09:16 ewitt 阅读(158) 评论(0) 推荐(0) 编辑

2021年5月14日

标准库集锦

摘要: #include<bits/stdc++.h> using namespace std; #define MAX 200005 #define lson (p<<1) #define rson (p<<1|1) #define mid ((l + r) >> 1); typedef pair<int 阅读全文

posted @ 2021-05-14 13:33 ewitt 阅读(16) 评论(0) 推荐(0) 编辑

导航