- 博客(8)
- 资源 (1)
- 收藏
- 关注
原创 JAVA实现并查集类
public class Unifind{ private int[] fa; private int[] rank; public Unifind(int n) { this.fa=new int[n]; this.rank = new int[n]; for(int i=0;i<n;i++) { this.
2021-01-12 11:13:52
208
原创 C实现链表的基本操作
1.删除链表中的节点 voiddeleteNode(structListNode*node){ node->val=node->next->val; node->next=node->next->next; } 2.反转链表 struct ListNode* reverseList(struct ListNode* head){ struct ListNode *pre =NULL; struct ListNode ...
2020-12-29 14:07:08
150
原创 Java实现链式向前向星与spfa
import java.util.*; class node{ int to; int v; int next; int form; } public class hello{ static int [] head= new int [10000]; static int cnt=0; static int [] inq = new int [10000]; static node [] e =new node[10000]; st.
2020-06-17 12:14:34
297
原创 UVA156 map的应用
提取一段文字中所有不重复(不能通过字母重排后得到相同单词)的单词,重拍时按小写,输出按照原格式 #include<iostream> #include<vector> #include<map> #include<string> #include<algorithm>//sort函数 using namespace std; strin...
2019-04-24 22:29:00
146
原创 UVA 1354 天平难题 DFS
房间宽度r 天平个数s 设计尽量宽的天平放置在房间中 #include<iostream> #include<cstring>//memset函数 #include<cstdio> using namespace std; double r; int wei,s; int vis[10050]; double maxx; struct tree{ do...
2019-04-24 22:23:19
155
原创 DFS 迭代加深搜索 埃及分数问题
例如2/3=1/2+1/3 但不允许2/3=1/3+1/3即相同得数出现,且加数总数越少越好,相同得情况下最小的分数越大越好 代码: #include<iostream> using namespace std; int maxd; int ans[100]={-1},v[100]={0}; int getfirst(int a,int b) { if(b%a==0) ...
2019-04-19 21:45:24
287
原创 BFS uva1601 万圣节后的早晨
难点在于如何记录当前的状态,存入栈中又将其转化为位置信息。 #include<iostream> #include<cstring> #include<vector> #include<queue> #include<cstdio> using namespace std; int w,h,n; int d[256][256][2...
2019-04-17 23:05:46
172
原创 Crashing Balloon因子的计算
碰撞气球 时间限制:2秒内存限制:65536 KB 每年6月1日的儿童节,都会有一个名为“爆气球”的电视节目。这个规则很简单。地面上有100个标有气球的气球,号码是1到100。裁判员喊道:“走吧!”这两名选手每人以1分开始比赛,用脚撞倒气球,同时把他们的分数乘以写在气球上的数字。一分钟后,小观众就可以把剩下的气球拿走,每个参赛者都会报告他自己的得分,即他坠毁的气球上的数字。非正式的赢家是宣...
2018-07-18 15:53:43
540
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅