会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
墨鳌
算法+数据结构=整个世界
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
6
7
8
9
10
11
12
13
14
···
24
下一页
2020年3月13日
三维向量差积,以及应用
摘要: Cross u,v gets a new vector uxv The result of uxv is: uxv=(Yu*Zv–Zu*Yv)*i+(Zu*Xv–Xu*Zv)*j+(Xu*Yv–Yu*Xv)*k We use the determinant to memory it. Actuall
阅读全文
posted @ 2020-03-13 22:43 墨鳌
阅读(469)
评论(0)
推荐(0)
2020年3月12日
C++-蓝桥杯-分考场[2017真题][搜索][无向图染色]
摘要: 着实精妙! 女少口阿!女少口阿! 1 #include <iostream> 2 #define N 100//思路:可以抽象为无向图染色问题。相邻顶点不能染相同颜色,问至少要用多少种颜色。 3 using namespace std; 4 int n,m,a,b,ans,next[N][N],ma
阅读全文
posted @ 2020-03-12 20:38 墨鳌
阅读(362)
评论(0)
推荐(0)
2020年3月11日
C++-POJ1094-Sorting It All Out[拓扑排序][邻接矩阵]
摘要: 1 #include<cstdio> 2 #include<cstring> 3 int map[27][27],indegree[27],q[27]; 4 int TopoSort(int n){ 5 int t=0,temp[27],p,m,flag=1; //flag=1:有序 flag=-1
阅读全文
posted @ 2020-03-11 17:47 墨鳌
阅读(172)
评论(0)
推荐(0)
2020年3月10日
C++-LUOGU1059-明明的随机数[堆排序]
摘要: 就是秀一波操作辣 1 #include <iostream> 2 using namespace std; 3 const int N=1e3+20; 4 int ans[N],cnt=1; 5 struct heap{ 6 int a[N],n; 7 int top(){return a[1];}
阅读全文
posted @ 2020-03-10 11:11 墨鳌
阅读(246)
评论(0)
推荐(0)
2020年3月9日
C++-快速排序[STL][快速排序][并归排序][堆排序]
摘要: 1 #include <queue> 2 #include <iostream> 3 using namespace std; 4 priority_queue<int>q; 5 int main(){ 6 for(int a;cin>>a;q.push(-a)) 7 if(a==0){ 8 for
阅读全文
posted @ 2020-03-09 13:25 墨鳌
阅读(364)
评论(0)
推荐(0)
2020年3月8日
C++-蓝桥杯-波动数组[2014真题][DP优化]
摘要: 无非是计算s1个+a和s2个-b的排列数(s1+s2=(1+n)*n/2=sum) 比如在第一位+a的话,之后的每个数都累积了+a,相当于当前排上了n-1个+a 所以,可以设状态f[i][j]为:用数字1~i(每个只能选一次)可以组成和为j的方案数 实际上就是一个容量=价值的01背包 对于s1(0~
阅读全文
posted @ 2020-03-08 23:44 墨鳌
阅读(292)
评论(0)
推荐(0)
C++-蓝桥杯-[T1~T3][结果填空题][2015真题][水题]
摘要: T1.求a^2+b^2+c^2=1000正整数解 1 #include <cstdio> 2 int main(){ 3 for(int a=1;;a++) 4 for(int b=a;b<=33;b++) 5 for(int c=b;c<=33;c++) 6 if(a*a+b*b+c*c==100
阅读全文
posted @ 2020-03-08 17:28 墨鳌
阅读(205)
评论(0)
推荐(0)
2020年3月7日
C++-蓝桥杯-斐波拉契[2014真题][数学推导][数论][矩阵快速幂][大数取模][快速防爆乘]
摘要: 首先一秒钟想到的斐波拉契模板,矩阵快速幂加速 之前有过类似博客,这里不赘述原理。 1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 using namespace std; 5 typedef long long ll;
阅读全文
posted @ 2020-03-07 16:17 墨鳌
阅读(261)
评论(0)
推荐(0)
2020年3月6日
C++-蓝桥杯-地宫取宝[2014真题][记忆化搜索]
摘要: 一开始想的是dp四维状态都设好了,然后写起来贼恶心 然后改搜索,四类分支都想好了,但是复杂度又不对? 放弃后,看题解,艹,还真是两者结合起来,记忆化搜索。 好吧,不愧是你,蓝桥杯,这么喜欢暴力算法! PS: 对于一个搜索状态,其返回值可能为0,所以数组初值要赋为-1 1 #include <cstd
阅读全文
posted @ 2020-03-06 01:03 墨鳌
阅读(174)
评论(0)
推荐(0)
2020年3月5日
C++-蓝桥杯-蚂蚁感冒[2014真题][模拟]
摘要: 蚂蚁出界了我没有标记居然可以过样例?还有25分?GG 补上标记就A了,2014真题真的水,蓝桥杯啊蓝桥杯!! 1 #include <cmath> 2 #include <cstdio> 3 #include <iostream> 4 #include <algorithm> 5 using nam
阅读全文
posted @ 2020-03-05 20:27 墨鳌
阅读(168)
评论(0)
推荐(0)
上一页
1
···
6
7
8
9
10
11
12
13
14
···
24
下一页
公告