蓝桥杯
楠姐有点忙
数学建模国奖得主|00后保研黑马选手|计算机学院研0|干货资料免费领取
展开
-
蓝桥杯试题——子串分值
蓝桥杯试题——子串分值#include<iostream>#include<string>#include<cstring>using namespace std;int c[26]; //二十六个字母string s;int f(int m, int n){ int a = 0; for (int i = m; i <= n; i++) c[s[i] - 'a']++; //对应字母加加 for (int i = 0; i &原创 2021-04-11 19:14:58 · 144 阅读 · 0 评论 -
蓝桥杯试题——路径之谜
蓝桥杯试题——路径之谜#include<iostream>#include<cstring>#include<vector>using namespace std;int num;int x[20];int y[20];int po[4][2] = { {1,0},{0,1},{-1,0},{0,-1} };int visited[20][20];vector<int> step;int X() { for (int i =原创 2021-03-26 10:08:37 · 134 阅读 · 0 评论 -
蓝桥杯试题——随意组合
蓝桥杯试题——随意组合答案:24#include<iostream>#include<cstring>int num[9] = { 0,1,2,3,4,5,6,7,8 };int ans;using namespace std;int accord(){ int a1, a2, a3, a4, b1, b2, b3, b4, sum1, sum2; a1 = num[1] * 10 + num[2]; a2 = num[3] * 10 + num[4];原创 2021-03-22 16:54:55 · 417 阅读 · 0 评论 -
蓝桥杯试题——G将军有一支训练有素的军队
蓝桥杯试题——G将军有一支训练有素的军队样例输入1:31 1样例输出1:4样例输入271 1 2 2 3 3样例输出240#include<iostream>#include<cstring>#include<vector>using namespace std;int superior[100002];int soldiers[100002];vector<int> subordinate[100002];i原创 2021-03-22 15:53:11 · 106 阅读 · 0 评论 -
蓝桥杯试题——独数游戏
蓝桥杯试题——独数游戏测试样例:005300000800000020070010500400005300010070006003200080060500009004000030000009700样例结果:145327698839654127672918543496185372218473956753296481367542819984761235521839764代码:#include<iostream>#include<cstdio原创 2021-03-22 12:37:12 · 97 阅读 · 0 评论 -
蓝桥杯试题——7对数字
蓝桥杯试题——7对数字#include<iostream>#include<cstring>using namespace std;int a[14];int f(int n){ if(n==0) return 1; else{ if(n==4) n--; for(int i=0;i+n+1<14;i++) if(a[i]==0&&a[i+n+1]==0){ a[i]=n; a[i+n+1]=n; if(f(原创 2021-03-20 21:12:41 · 96 阅读 · 0 评论 -
蓝桥杯试题——生命之树
蓝桥杯试题——生命之树#include<iostream>#include<vector>#include<cstring>using namespace std;struct tree{ int value; vector<int> next;};int visited[1000000];tree TREE[100000];int MAX;int dfs(int node){ int count,C=0; for(int原创 2021-03-20 16:55:43 · 171 阅读 · 0 评论 -
蓝桥杯试题——垒骰子
蓝桥杯试题——垒骰子#include<iostream>using namespace std;int N,M;struct op{ int m; int n;};op OP[1000000];int Opposite(int n){ if(n==1) return 4; else if(n==2) return 5; else if(n==3) return 6; else if(n==4) return 1; else if(n==5) retur原创 2021-03-19 16:52:33 · 69 阅读 · 0 评论 -
蓝桥杯试题——灾后重建
蓝桥杯试题——灾后重建#include<iostream>#include<cstring>int N, M, Q;int x;int C;int visited[5002];int p[5002];using namespace std;struct Map { int arc[5002][5002]; int vexnum; int arcnum;};Map map;void Init(){ for (int i = 0; i <原创 2021-03-19 15:57:59 · 444 阅读 · 0 评论 -
蓝桥杯试题 算法训练 绘制地图
蓝桥杯试题 算法训练 绘制地图问题描述最近,WYF正准备参观他的点卡工厂。WYF集团的经理氰垃圾需要帮助WYF设计参“观”路线。现在,氰垃圾知道一下几件事情: 1.WYF的点卡工厂构成一颗二叉树。 2.一共有n座工厂。 3.他需要把这颗树上的点以后序遍历的方法列出来,才能绘制地图。 还好,最近他的属下给了他先序遍历和中序遍历的数据。可是,氰垃圾最近还要帮㊎澤穻解决一些问题,没有时间。请你帮帮他,替他完成这项任务。由于氰垃圾的一些特殊的要求,WYF的参观路线将会是这棵树的后序遍历。输入原创 2021-03-16 17:02:16 · 772 阅读 · 0 评论 -
蓝桥杯试题——汉诺塔问题
蓝桥杯试题——汉诺塔问题#include<iostream>#include<cstring>int Step,x,y;long long int ANS[6];using namespace std;int Between(){ if(Step>=x&&Step<=y) return 1; else return 0;}void Count(int From,int End){ if(From=='A'){ if(E原创 2021-03-15 17:21:40 · 422 阅读 · 1 评论 -
蓝桥杯试题——基因配对
蓝桥杯试题——基因配对#include<iostream>#include<cstring>using namespace std;char L[1000000];char S[1000000];int len1;int len2;int Compare(int n){ int j=0; for(int i=n;i<len1;i++){ if(L[i]!=S[j]) return 0; else if(L[i]==S[j]&&原创 2021-03-15 16:07:20 · 343 阅读 · 0 评论 -
蓝桥杯试题——网站扩充
蓝桥杯试题——网站扩充#include<iostream>#include<cstring>using namespace std;int main() { int n; int F[300];//最大规模300 memset(F,0,sizeof(int)*300);//初始化 cin>>n; if(n<=7) cout<<"1"; else{ for(int i=0;i<7;i++) F[i]=1; fo原创 2021-03-15 15:06:53 · 170 阅读 · 0 评论