03 2020 档案

摘要:https://blog.csdn.net/Gentleman_Qin/article/details/79963396 阅读全文
posted @ 2020-03-18 18:04 墨鳌 阅读(180) 评论(0) 推荐(0)
摘要: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 墨鳌 阅读(470) 评论(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 墨鳌 阅读(362) 评论(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 墨鳌 阅读(175) 评论(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 墨鳌 阅读(250) 评论(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 墨鳌 阅读(368) 评论(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 墨鳌 阅读(294) 评论(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 墨鳌 阅读(209) 评论(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 墨鳌 阅读(265) 评论(0) 推荐(0)
摘要:一开始想的是dp四维状态都设好了,然后写起来贼恶心 然后改搜索,四类分支都想好了,但是复杂度又不对? 放弃后,看题解,艹,还真是两者结合起来,记忆化搜索。 好吧,不愧是你,蓝桥杯,这么喜欢暴力算法! PS: 对于一个搜索状态,其返回值可能为0,所以数组初值要赋为-1 1 #include <cstd 阅读全文
posted @ 2020-03-06 01:03 墨鳌 阅读(175) 评论(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 墨鳌 阅读(172) 评论(0) 推荐(0)
摘要:check全排列,保留字典数最小解 answer: 2342A3A4 1 #include <bits/stdc++.h> 2 using namespace std; 3 char c[8]={'A','A','2','2','3','3','4','4'}; 4 char r[8],ans[8] 阅读全文
posted @ 2020-03-05 18:12 墨鳌 阅读(213) 评论(0) 推荐(0)
摘要:网络上流传的版本是错的,还有那么多人转载,真的是醉了 代码的思路是比较a数组,用b数据记录下标,故答案为(a[b[k1]]>a[b[k2]]) 1 #include<bits/stdc++.h> 2 //重新决出k号位置,v为已输出值 3 void pk(int* a, int* b, int n, 阅读全文
posted @ 2020-03-05 17:29 墨鳌 阅读(237) 评论(0) 推荐(0)
摘要:四个不同数码凑一个乘法算式,结果恰好仍然只含这四个数码 1 #include <bits/stdc++.h> 2 using namespace std; 3 int ij[10],vis[10]; 4 bool check(int i,int j){ 5 int k=i*j,cnt=0; 6 me 阅读全文
posted @ 2020-03-04 23:14 墨鳌 阅读(165) 评论(0) 推荐(0)
摘要:我就笑笑,这不是手玩dp吗?! 1 #include <bits/stdc++.h> 2 using namespace std; 3 int f[20]; 4 int main(){ 5 f[0]=2; 6 for(int i=1;i<20;i++) 7 f[i]=f[i-1]*2-1; 8 co 阅读全文
posted @ 2020-03-04 22:51 墨鳌 阅读(171) 评论(0) 推荐(0)
摘要:1 #include <bits/stdc++.h> 2 using namespace std; 3 int main(){//a*b=6*(a+b) abs(a-b)<8 4 for(int a=1;a<=18;a++) 5 for(int b=a+1;b<a+8;b++) 6 if(a*b== 阅读全文
posted @ 2020-03-04 22:37 墨鳌 阅读(211) 评论(0) 推荐(0)
摘要:最坑的一点是没有数据范围,但是就蓝桥杯的德性,int就够了然后数组尽可能开大一点 O(n)算法要自信,嗯嗯嗯! 一次AC,没什么好说的,上代码: 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 const int 阅读全文
posted @ 2020-03-04 14:17 墨鳌 阅读(228) 评论(0) 推荐(0)
摘要:如题: 将矩阵剪成相连的两个联通块,可以有环,使得两部分权值和相等 数据范围矩阵<10x10,权值和<1000000 我寻思着觉得复杂度不对啊?自己卡个数据都会T,题目的数据太水了 dfs是错误写法,对于不满足从(1,1)开始的一笔完成的图像,就会出错 例如: 2 2 1 1 1 3 答案是:3 而 阅读全文
posted @ 2020-03-03 20:02 墨鳌 阅读(365) 评论(1) 推荐(0)
摘要:已知方程为ax+by=c,现给出a,b,求max(c)对方程x,y无自然数解 数据保证c有最大值 题目保证了c没有上界,所以gcd(a,b)=1互质 根据数学结论,max(c)=a*b-a-b 证明:二元一次不定方程ax+by=N,gcd(a,b)=1,a>1,b>1 当N>ab-a-b时有非负整数 阅读全文
posted @ 2020-03-03 18:27 墨鳌 阅读(376) 评论(0) 推荐(0)
摘要:在一连串不定长的数字中找出断号和重号的输出 数据保证只有唯一解 1 #include <iostream> 2 #include <algorithm> 3 using namespace std; 4 const int N=1e5+10; 5 int ID[N],cnt,Bucket[N],Ma 阅读全文
posted @ 2020-03-03 16:39 墨鳌 阅读(203) 评论(0) 推荐(0)
摘要:1 #include <bits/stdc++.h> 2 using namespace std; 3 const int N=1e4; 4 int A[N],W[N],num[10]={0,1,2,-1,-1,5,9,-1,8,6}; 5 int change(int x){ 6 int a=x% 阅读全文
posted @ 2020-03-02 20:19 墨鳌 阅读(251) 评论(0) 推荐(0)
摘要:这么水的题,唉,三种方法花式过,考的是思维吧?滑稽 1 #include <iostream> 2 using namespace std; 3 int dp[10][10]; 4 int f(int x,int y){ 5 if(x==1||y==1)return 1; 6 return f(x- 阅读全文
posted @ 2020-03-02 19:17 墨鳌 阅读(246) 评论(0) 推荐(0)
摘要:1 #include <bits/stdc++.h> 2 using namespace std; 3 bool vis[15]; 4 bool check(long long a,long long b){ 5 memset(vis,0,sizeof(vis)); 6 while(a) 7 if( 阅读全文
posted @ 2020-03-02 16:44 墨鳌 阅读(256) 评论(0) 推荐(0)
摘要:1 #include <bits/stdc++.h> 2 using namespace std; 3 bool Check(int y){return (y%4==0&&y%100)||(y%400==0);} 4 void calc(int Y,int M,int D,int x){ 5 int 阅读全文
posted @ 2020-03-02 16:27 墨鳌 阅读(231) 评论(0) 推荐(0)
摘要:1 /* 2 3 购物清单 4 5 小明刚刚找到工作,老板人很好,只是老板夫人很爱购物。 6 老板忙的时候经常让小明帮忙到商场代为购物。 7 小明很厌烦,但又不好推辞。 8 9 这不,XX大促销又来了!老板夫人开出了长长的购物单,都是有打折优惠的。 10 小明也有个怪癖,不到万不得已,从不刷卡,直接 阅读全文
posted @ 2020-03-02 13:23 墨鳌 阅读(390) 评论(0) 推荐(0)
摘要:1 #include <cstdio> 2 int a[10],copy[10],cnt,ans,flag; 3 bool check(){ 4 int sum=a[1]+a[2]+a[3]; 5 if(sum!=a[4]+a[5]+a[6])return false; 6 if(sum!=a[1] 阅读全文
posted @ 2020-03-02 11:09 墨鳌 阅读(330) 评论(0) 推荐(0)
摘要:呵呵,题目都这么明确了,题解什么的,就不需要了吧! 和上一篇poj2104的题意一模一样,数据范围*2了而已,可以直接复制代码过去a掉 但是我还是兢兢业业的重新敲了一遍,种树这种事情要勤奋嘛! 介于昨天刚学,自是不能领悟Insert操作的精妙之处 故今天写代码时先建了一颗nlogn的空树,方便查找( 阅读全文
posted @ 2020-03-01 12:59 墨鳌 阅读(144) 评论(0) 推荐(0)