自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(46)
  • 收藏
  • 关注

原创 蒜头君的最大子矩阵和

题目:代码如下:#include<bits/stdc++.h>using namespace std;#define NIL 1e9long long a[405][405],pre[405][405]; int main(){ long long n,m,sum,ans = -NIL; cin >> n >> m; for(int i =...

2019-02-28 20:41:04 814 1

原创 蒜头君的最大子段和

题目:代码如下:#include<bits/stdc++.h>using namespace std;#define MAX 1000005#define NIL 1e9typedef long long LL;LL a[MAX];int main(){ LL n,sum = 0,ans = -NIL; cin >> n; for(int i = ...

2019-02-28 19:05:51 721

原创 过河

题目:代码如下:#include<bits/stdc++.h>using namespace std;int a[1005],dp[1005];int main(){ int n; cin >> n; for(int i = 0;i < n;i++) cin >> a[i]; sort(a,a + n); dp[0] = a[0];...

2019-02-28 17:59:41 178

原创 数组分组

题目:代码如下:#include<bits/stdc++.h>using namespace std;int a[1005],dp[1005],pre[1005][1005];int main(){ int n,sum = 0; cin >> n; for(int i = 1;i <= n;i++) cin >> a[i]; for...

2019-02-27 21:49:04 377

原创 一维消消乐

题目:代码如下:#include<bits/stdc++.h>using namespace std;int a[10005];int dp[10005][2]; //dp[i][0]代表到第i个珠子时不和其前一个珠子结合时最大值,dp[i][1]表到第i个珠子时和其前一个珠子结合时最大值int main(){ int n,maxn; cin >> n;...

2019-02-27 20:48:39 3671

原创 逃生

题目:代码如下:#include<bits/stdc++.h>using namespace std;#define NIL 1e9int a[1005][1005],dp[1005][1005],dir[4][2] = {{1,1},{-1,1},{-1,1},{1,-1}};int main(){ int n,m,x,y,v,c,ans; cin >&g...

2019-02-27 20:00:05 201

原创 蒜头君的新游戏

题目:代码如下:#include<bits/stdc++.h>using namespace std;int dp[35][35];int main(){ int n,m; cin >> n >> m; dp[0][1] = 1; //dp[i][j]代表传i次娃娃的时候最后回到j手上的可能方案数 for(int i = 1;i &lt...

2019-02-27 18:35:41 242

原创 打水滴

题目:代码如下:#include<bits/stdc++.h>using namespace std;#define MAX 105int n,m,L,sum[MAX][MAX],tt[MAX][MAX],dir[4][2] = {{1,0},{0,1},{-1,0},{0,-1}};struct Point {int x,y,pos,t;}point;void b...

2019-02-26 17:38:33 494

原创 蒜头君回家

题目:代码如下:#include<bits/stdc++.h>using namespace std;#define MAX 2005char a[MAX][MAX];int x,y,n,m,dir[4][2] = {{1,0},{0,1},{-1,0},{0,-1}};bool vis[MAX][MAX][2];struct Point{ int x2,y2,...

2019-02-25 20:25:10 352

原创 吃糖的时间

题目:代码如下:#include<bits/stdc++.h>using namespace std;#define MAX 100005int n,p,c,m;vector<int>a[MAX];bool vis[MAX];struct People{ int num2,get2,eat2; People() {} People(int a,i...

2019-02-23 21:17:43 530 1

原创 leetcode 343 Integer Break

题目:给定一个数字n,可以将其分割成多个数字的和,若要让这些数字的乘机最大,求分割的方法(至少要分出两个数)。算法返回这个最大的乘机。代码如下:(递归版)#include<bits/stdc++.h>using namespace std;int n;int breakinteger(int n){ int maxn = -1; if(n == 1) return 1...

2019-02-22 19:22:25 198

原创 三阶平面魔方

题目:代码如下:#include<bits/stdc++.h>using namespace std;struct node{ int a[3][3]; bool operator == (const node &x) const{ //判断是否相等 for(int i = 0;i < 3;i++){ for(int j = 0;j <...

2019-02-22 15:48:49 903 1

原创 密码锁

题目:代码如下:#include<bits/stdc++.h>using namespace std;int n,m,tx,a[4],vis[10005];struct Point{ int x,step; Point() {} Point(int xx,int step2):x(xx),step(step2) {}}point;int bfs(int n,in...

2019-02-22 15:10:11 325

原创 置换的玩笑

题目:小蒜头又调皮了。这一次,姐姐的实验报告惨遭毒手。姐姐的实验报告上原本记录着从 1 到 n 的序列,任意两个数字间用空格间隔。但是“坑姐”的蒜头居然把数字间的空格都给删掉了,整个数字序列变成一个长度为 1 到 100 的且首部没有空格的数字串。现在姐姐已经怒了,蒜头找你写个程序快点把试验数据复原。输入输入文件有一行,为一个字符串——被蒜头搞乱的实验数据。字符串的长度在 1 到 10...

2019-02-21 15:30:26 432

原创 因数最多的数

题目:代码如下:#include<bits/stdc++.h>using namespace std;typedef long long LL;LL n,ans;int mc,prime[15] = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47};void dfs(int u,int m,LL x,LL cnt) //u:用了几个...

2019-02-21 13:26:58 3029

原创 正方形

题目:蒜头君手上有一些小木棍,它们长短不一,蒜头君想用这些木棍拼出一个正方形,并且每根木棍都要用到。 例如,蒜头君手上有长度为 1,2,3,3,3 的 5 根木棍,他可以让长度为1,2 的木棍组成一条边,另外三根分别组成 3 条边,拼成一个边长为 3 的正方形。蒜头君希望你提前告诉他能不能拼出来,免得白费功夫。输入格式首先输入一个整数n(4≤n≤20),表示木棍数量,接下来输入 n 根木棍的...

2019-02-21 10:45:06 563 1

原创 全排列

题目:代码如下:#include<bits/stdc++.h>using namespace std;int n,a[3628805],sum,sum2,vis[15],k = 0;bool f;void dfs(int num,int len) //num是组合数现在的值,len代表位数 { if(f) return; if(len <= 0){a[k+...

2019-02-20 18:56:53 89

原创 找数字

题目:给一个数 nn,让你找出一个只由 0,10,1 组成的十进制数 mm,要求这个正整数 mm 可以被 nn 整除。输入格式:输入一个整数 n (1≤n<200)。输出格式:对于输入整数 n的每一个值,输出 m 的相应值,保证有一个数字长度小于 19 位的数字.如果有一个给定值 n 有多个解,其中任何一个都是可以接受的.本题答案不唯一,符合要求的答案均正确样例输入2样例...

2019-02-20 16:09:37 646

原创 2n皇后问题

题目:代码如下:#include<bits/stdc++.h>using namespace std;int a[10][10],ans,n,vy[10],vv1[10],vv2[10];//vy,v1,vv2分别有四种状态0是黑白皇后都没放,1是放了黑皇后,2是放了白皇后,3是都放了 void dfs(int x,int p){ if(p == 2 &&a...

2019-02-19 19:23:53 218

原创 数独

题目:代码如下:#include<bits/stdc++.h>using namespace std;char a[10][10];bool vx[10][10],vy[10][10],vv[10][10],f;//分别对行,列,3*3区域进行判重 void dfs(int x,int y){ if(f) return;//保证只打印一个9*9 if(x ==...

2019-02-19 13:09:34 91

原创 等边三角形

题目:蒜头君手上有一些小木棍,它们长短不一,蒜头君想用这些木棍拼出一个等边三角形,并且每根木棍都要用到。 例如,蒜头君手上有长度为 11,22,33,33 的4根木棍,他可以让长度为11,22 的木棍组成一条边,另外 22 跟分别组成 22 条边,拼成一个边长为 33 的等边三角形。蒜头君希望你提前告诉他能不能拼出来,免得白费功夫。输入格式首先输入一个整数 n(3 \le n \le 20)...

2019-02-19 10:11:29 393

原创 蒜头君开公司

题目:2020 年,蒜头君自己开了一家拥有 N 个员工的大公司。每天,蒜头君都要分配 N 项工作给他的员工,但是,由于能力的不同,每个人对处理相同工作所需要的时间有快有慢。众所周知,蒜头君是一个非常重视效率的人,他想知道该如何分配工作,才能使得完成所有工作的时间总和最小(每个员工只可以被分配到一个工作)。但是我们也都知道蒜头君不是一般的懒,所以蒜头君找到了你,请你拯救一下蒜头君吧!输入格式第...

2019-02-18 22:30:51 385

原创 马的覆盖点

题目:代码如下:#include<bits/stdc++.h>using namespace std;char a[105][105];int n,m,x,y;int direction[8][2] = {{2,1},{1,2},{-1,2},{-2,1},{-2,-1},{-1,-2},{1,-2},{2,-1}};void dfs(int x,int y,int ...

2019-02-18 17:47:19 670

原创 家谱

题目:代码如下:#include<bits/stdc++.h>using namespace std;#define MAX 100005int n,f[MAX],u[MAX],v;vector<int> a[MAX];int dfs(int x){ int res = 0; for(int i = 0;i < a[x].size();i++)...

2019-02-18 17:16:47 423

原创 网页跳转

题目:代码如下:#include<bits/stdc++.h>using namespace std;int main(){ int n,num = 0; string str,web,temp; bool flag; stack<string> s1,s2; cin >> n; for(int i = 0;i < n;i++)...

2019-02-16 14:22:48 432

原创 括号匹配

题目:蒜头君在纸上写了一个串,只包含’(‘和’)’。一个’(‘能唯一匹配一个’)’,但是一个匹配的’(‘必须出现在’)’之前。请判断蒜头君写的字符串能否括号完全匹配,如果能,输出配对的括号的位置(匹配的括号不可以交叉,只能嵌套)。输入格式一行输入一个字符串只含有’(‘和’)’,输入的字符串长度不大于50000。输出格式如果输入括号不能匹配,输出一行”No”,否则输出一行”Yes”,接下里...

2019-02-16 11:45:09 290

原创 蒜头君吃桃

题目:蒜头君买了一堆桃子不知道个数,第一天吃了一半的桃子,还不过瘾,有多吃了一个。以后他每天吃剩下的桃子的一半还多一个,到 n 天只剩下一个桃子了。蒜头君想知道一开始买了多少桃子。输入格式输入一个整数 n(2≤n≤60),代表第 n只剩了一个桃子。输出格式输出买的桃子的数量。样例输入12样例输出14样例输入23样例输出210代码如下:递归版:#include<...

2019-02-15 20:16:18 439

原创 汉诺塔问题

题目:代码如下:#include<bits/stdc++.h>using namespace std;long long f[65],g[65];int main(){ int n; cin >> n; g[1] = f[1] = 1; for(int i = 2;i <= n;i++) f[i] = 2 * f[i - 1] + 1; f...

2019-02-15 20:08:19 128

原创 蒜头君破案

题目:代码如下:#include<bits/stdc++.h>using namespace std;#define MAX 200005struct People{ int height,weight,age; People() {} People(int h,int w,int a):height(h),weight(w),age(a) {} bool op...

2019-02-14 16:18:29 462

原创 打印锯齿矩阵

题目:代码如下:#include<bits/stdc++.h>using namespace std;int main(){ int n,m,x,y; cin >> n >> m; vector<vector<int> > p(n,vector<int>()); for(int i = 0;i < ...

2019-02-14 14:21:53 654

原创 练习题:机器人

题目:蒜头君收到了一份礼物,是一个最新版的机器人。这个机器人有 4 种指令:forward x,前进x米。back x,先向后转,然后前进x米。left x,先向左转,然后前进x米。right x,先向右转,然后前进x米。现在把机器人放在坐标轴原点,起始朝向为x轴正方向。经过一系列指令以后,你能告诉蒜头君机器人的坐标位置吗。坐标轴上一个单位长度表示1米。输入格式第一行输入一个整数n...

2019-02-13 16:13:28 1173

原创 练习题:回文数

题目:一个正整数,如果交换高低位以后和原数相等,那么称这个数为回文数。比如 121,2332 都是回文数,13,456713,4567 不是回文数。任意一个正整数,如果其不是回文数,将该数交换高低位以后和原数相加得到一个新的数,如果新数不是回文数,重复这个变换,直到得到一个回文数为止。例如,57 变换后得到 132(57+75),132 得到 363(132+231),363是一个回文数。曾...

2019-02-13 14:54:16 766

原创 习题:节假日

题目:日历有 阳历(公历) 和 阴历(农历) 之分。每年都有法定节假日,这些分成三类—双休、阳历节假日、阴历节假日。双休1)周六和周日 2 天阳历节假日1)元旦:阳历每年 1 月 1 日,放假 1 天2)劳动节:阳历每年 5 月 1 日,放假 1 天3)国庆节:阳历每年 10 月 1 日,放假 3 天4)圣诞节:阳历每年 12 月 25 日,放假 1 天阴历节假日1)春节:阴历...

2019-02-09 14:52:33 703

原创 习题:蒜头君的生日

题目:代码如下:#include <iostream>#include <string>using namespace std;int whatday(int y, int m, int d) { if(m == 1) y--,m = 13; else if(m == 2) y--,m = 14; return (d + 2 * m + ...

2019-02-08 16:56:43 596

原创 2019 蓝桥杯省赛 B 组模拟赛(一) J. 程序设计:蒜厂年会

题目链接:https://nanti.jisuanke.com/t/36118代码如下:#include<bits/stdc++.h>using namespace std;#define MAX 100005#define NIL 1e9long long a[MAX],f[MAX];int main(){ long long n,maxn = -NIL,m...

2019-02-07 20:32:38 220

原创 2019 蓝桥杯省赛 B 组模拟赛(一) I. 程序设计:抠图

题目链接:https://nanti.jisuanke.com/t/36117代码如下:#include<iostream>#include<cstdio>#include<queue>using namespace std;#define MAX 505int mp[MAX][MAX];int direction[4][2] = {{1,0}...

2019-02-07 19:03:38 321

原创 2019 蓝桥杯省赛 B 组模拟赛(一) 轻重搭配

题目链接:https://nanti.jisuanke.com/t/36116代码如下:#include<iostream>#include<cstdio>#include<algorithm>using namespace std;#define MAX 500005int a[MAX];int main(){ int n,p

2019-02-07 15:17:05 209

原创 2019 蓝桥杯省赛 B 组模拟赛(一) G. 程序设计:后缀字符串

题目链接:https://nanti.jisuanke.com/t/36115代码如下:#include<iostream>#include<cstring>#include<cstdio>#include<map>using namespace std;#define MAX 100005string str[MAX];int ...

2019-02-07 14:40:06 539

原创 2019 蓝桥杯省赛 B 组模拟赛(一) F. 程序设计:找质数

题目链接:https://nanti.jisuanke.com/t/36114代码如下:#include<iostream>#include<cstring>#include<cstdio>using namespace std;#define MAX 1000005int prime[MAX];bool vis[MAX];//预处理筛选素数...

2019-02-07 13:38:21 850

原创 I - Currency Exchange

题目:Several currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these currencies. There...

2019-02-06 18:46:53 173

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除