
算法
xicheng_404
这个作者很懒,什么都没留下…
展开
-
天梯赛 L2-022 重排链表
天梯赛 L2-022 重排链表原创 2022-07-04 16:50:35 · 207 阅读 · 1 评论 -
天梯赛 L2-041 插松枝
天梯赛 L2-041 插松枝(队列,栈)原创 2022-07-04 10:44:27 · 547 阅读 · 0 评论 -
最长上升子序列
#include<bits/stdc++.h>using namespace std;int i,j,n,a[20003],m=0,f[20003]; //f[i]是指以i结尾的最长子序列长度 int main(){ cin>>n; for(i=1;i<=n;i++) cin>>a[i],f[i]=1;//子序列只有自身,则长度就是1 for(i=1;i<=n;i++) {//按照输入的顺序 ,开始计算数值f[i] for(j=1.原创 2021-11-11 20:46:27 · 104 阅读 · 0 评论 -
HDU 2050 (折线分割平面)
#include<bits/stdc++.h>using namespace std;int face(int m){ int c=0,s=0; if(m==2) c=0; for(int i=1;i<=m-2;i++) c+=i; s=c+m*2; return s;}int main(){ int n,m; scanf("%d",&n); while(n--) { sca原创 2021-05-20 20:42:01 · 132 阅读 · 0 评论 -
HDU 2046 (骨牌铺方格)
#include<bits/stdc++.h>using namespace std; int main(){ int i,n; double way[51]; way[1]=1,way[2]=2; for(i=3;i<=51;i++) way[i]=way[i-1]+way[i-2]; while(scanf("%d",&n)==1) { printf("%.f\n",way[n]); } return 0; } //若用递归,会出现超过时限的问题;原创 2021-05-19 20:18:21 · 97 阅读 · 0 评论 -
HDU 2044 (一只小蜜蜂)
#include<bits/stdc++.h>using namespace std;int main(){ int n,i,a,b; double road[51]; road[2]=1,road[3]=2; scanf("%d",&n); for(i=4;i<=50;i++) road[i]=road[i-1]+road[i-2]; while(n--) { scanf("%d %d",&a,&a原创 2021-05-19 19:50:26 · 97 阅读 · 0 评论 -
HDU 1233
题目;http://acm.hdu.edu.cn/showproblem.php?pid=1233#include <bits/stdc++.h>using namespace std;int parent[101];struct edge{ int a,b,dis;}nums[5000];int find(int x)//找根节点 { if (x!= parent[x]) parent[x] = find(parent[x]); return par原创 2021-05-13 19:40:06 · 97 阅读 · 0 评论 -
HDU1232
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1232#include<bits/stdc++.h>using namespace std;int a[1010];int find(int b) //寻找根 root{ int r=b; while(r!=a[r]) { r=a[r]; } return r;}void merge(int x,int y)//将集合merge并在一起; { int s=find(x);原创 2021-05-10 20:27:55 · 91 阅读 · 0 评论 -
hdu 2037
题目:http://acm.hdu.edu.cn/showproblem.php?pid=2037#include<bits/stdc++.h>using namespace std;struct node{ int s,e;}t[109];bool cmp(node x, node y){return x.e<y.e;}int main(){ int n,i,sum,a; while(scanf("%d",&n)==1) {原创 2021-04-18 12:27:54 · 148 阅读 · 0 评论 -
hdu 1098
题目;http://acm.hdu.edu.cn/showproblem.php?pid=1098#include <bits/stdc++.h>using namespace std;int main(){ int n; while(scanf("%d\n,&n")!=EOF) { n%=65; for(int i=0;i<=64;i++) { if((18+n*i)%65==0) { printf("%d\n",i); brea原创 2021-04-14 21:57:16 · 81 阅读 · 0 评论