上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 24 下一页
摘要: 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 墨鳌 阅读(440) 评论(0) 推荐(0) 编辑
摘要: 着实精妙! 女少口阿!女少口阿! 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 墨鳌 阅读(354) 评论(0) 推荐(0) 编辑
摘要: 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 墨鳌 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 就是秀一波操作辣 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 墨鳌 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 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 墨鳌 阅读(356) 评论(0) 推荐(0) 编辑
摘要: 无非是计算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 墨鳌 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 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 墨鳌 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 首先一秒钟想到的斐波拉契模板,矩阵快速幂加速 之前有过类似博客,这里不赘述原理。 1 #include <cstdio> 2 #include <cstring> 3 #include <iostream> 4 using namespace std; 5 typedef long long ll; 阅读全文
posted @ 2020-03-07 16:17 墨鳌 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 一开始想的是dp四维状态都设好了,然后写起来贼恶心 然后改搜索,四类分支都想好了,但是复杂度又不对? 放弃后,看题解,艹,还真是两者结合起来,记忆化搜索。 好吧,不愧是你,蓝桥杯,这么喜欢暴力算法! PS: 对于一个搜索状态,其返回值可能为0,所以数组初值要赋为-1 1 #include <cstd 阅读全文
posted @ 2020-03-06 01:03 墨鳌 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 蚂蚁出界了我没有标记居然可以过样例?还有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 墨鳌 阅读(159) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 24 下一页