自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 codeforces 1070H

暴力枚举直接枚举出所有的字符子串 然后直接map里面找就好了strstr()光荣了+kmp也t了过分真实#include <bits/stdc++.h>using namespace std;map <string,int> mp;map <string,string> pos;int main(){ string st;...

2018-11-07 22:10:23 144

原创 hihocoder 1829(2018 北京网络赛B

一共只有十组字符串+每个字符串<=8 可以想到暴力跑跑(大雾)玄学枚举 不宜模仿#include <bits/stdc++.h>#include <cstdio>#include <cstdlib>using namespace std;int cmp(string a,string b){ if(a.length()==b....

2018-11-07 22:06:48 150

原创 cf 558 - Amr and Chemistry

题意:  给你n个整数,你可以对这些数进行*2或者/2的操作,最终使n个数全部相同,问最少操作步骤是多少。思路:  由于这个题的范围是[1,1e5],可以直接对一个数进行枚举:把这个数和它(/2^n)之后的数一直乘2。代码:#include <bits/stdc++.h>using namespace std;int num[100005];int sum...

2018-10-23 13:02:33 232

原创 codeforces 1016B(哈希)

可能是我写的哈希太丑了疯狂被撞(逃)玄学水过去了​#include <bits/stdc++.h>#define mem(a) memset(a,0,sizeof(a))using namespace std;const int int_up = 2147483647;const long long ll_up = 9223372036854775807;...

2018-08-16 15:47:38 244

原创 树状数组

树状数组最重要的是lowbit操作(orz)(我也不知道画对没有)lowbit操作就是取最低位的1在上图中的0010只受到0001的影响;0100只受到0010+0011的影响;1000只受到0100+0110+0111的影响。(大雾) ...

2018-05-25 20:08:39 163

原创 搜索的蜜汁复习

orz弱智指数爆棚啊 切水题都不能愉快的切了(哭简单总结一下dfs(雾dfs框架dfs(){ if(终止条件) { xxxxx;(到终点时的操作) return; } if(剪枝) for(int i=0;i<n;i++)遍历节点 { if(满足条件) { ...

2018-04-24 21:55:16 168

原创 DP-A Charm Bracelet

最开始直接用的f[i][j]=max{f[i-1][j],f[i-1][j-c[i]]+w[i]}状态转移方程。二维数组MLE(大概超了3倍)可以对二维数组的空间复杂度优化,转换为一维数组。#include <cstdio>#include <cstring>#include <iostream>//#include <bits/stdc++.h&g...

2018-03-19 23:59:53 116

原创 线段树-A 敌兵布阵

HDU-1166 敌兵布阵简单的线段树的修改和区间查询#include <bits/stdc++.h>#define maxn 100007using namespace std;int Sum[maxn *2];int A[maxn],n;void PushUP(int rt)//求和{ Sum[rt] = Sum[rt*2] + Sum[rt*2+1];...

2018-03-04 23:07:14 256

原创 搜索-F 迷宫问题

迷宫问题DFS+回溯最开始的代码:在拐角处有奇怪的错误#include <stdio.h>#define esp 1e-8#include <string.h>#include <algorithm>using namespace std;int steps[26];//坐标都只有一位数 直接存储int now[26];int vis[6][...

2018-02-14 15:05:03 202

原创 二分-H Aggressive cows (POJ - 2456 )

最大化最小值#include <stdio.h>#include <algorithm>using namespace std;int c,n,count;int a[100005];int panduan (int mid){ int lpos = 0 , move = n-c; for (int i = 1;i < n;++i)...

2018-02-14 14:42:56 240

原创 二分-B Brainman (POJ - 1804 )

归并排序求逆序数对#include <stdio.h>#define esp 1e-8#include <string.h>#include <algorithm>using namespace std;int m[1005];//存数空间int t[1005];int ans;void hebing(int s,int mid,int...

2018-02-14 14:32:47 110

原创 二分-A Cable master (HDU-1551)

二分*注意精度问题#include <stdio.h>#define esp 1e-8#include <string.h>#include <algorithm>using namespace std;int n,k;double ss[10001];int panduan (double mid){ int sum = 0; ...

2018-02-14 13:01:56 121

原创 数学-I 小兔的棋盘

卡特兰数*不经过对角线的网格路线为卡特兰数*用数组存卡特兰数的通项,会在65项左右爆longlong 。#include <stdio.h>using namespace std;unsigned long long C[71][71];unsigned long long K[35]={0};int main(){ int i,j,k,cou=1; f...

2018-02-13 23:00:09 117

原创 数学-F Problem Makes Problem (LightOJ - 1102 )

将m个球放入n个盒子中,球同盒不同且盒子可以为空的情况为C(N+M-1, N-1)球和盒子的公式合集*longlong会爆 #include <stdio.h>#define mod 1000000007using namespace std;long long f[2000000];long long powMod(long long a, long long n, lon...

2018-02-13 22:47:49 205

原创 数学-D Send a Table (UVA - 10820)

题目大意:  求1~n之间共有多少对互质的数。欧拉函数:φ(n)=n*(1-1/p1)*(1-1/p2)*(1-1/p3)*(1-1/p4)…..(1-1/pn)。*需要注意的地方是用欧拉函数筛出来的会有重复。#include <stdio.h>using namespace std;int ss[50010];int main(){ int i,j; ...

2018-02-13 22:07:36 264

原创 数学-C Raising Modulo Numbers (POJ - 1995)

直接指数运算会爆longlong 倍增快速幂-将指数转换为二进制然后依据模运算  a*b%p = (a%p)*(b%p)%p 进行计算#include <stdio.h>long long powMod(long long a, long long n, long long p) { long long ans = 1; for(; n > 0; n >&...

2018-02-13 21:40:11 176

原创 数学-B Help Hanzo (LightOJ - 1197 )

暴力筛TLE直接开数组MLE#include <stdio.h>#include <math.h>#include <string.h>using namespace std;int vis[100010];long long sushu[100010];int shai[100010];int main(){ long long n...

2018-02-13 21:13:17 276

原创 Playing with Paper (CodeForces - 527A)

题目大意:  按最短边折,只到全部都折成正方形。输出有几个正方形。#include <cstdio>#include <algorithm>using namespace std;long long n = 0;long long gcd (long long a,long long b){ n+=(a-a%b)/b; return (a%...

2018-02-13 20:44:30 150

原创 STL-E The Blocks Problem (UVA - 101)

#include <cstdio>#include <string>#include <vector>#include <iostream>#include <string.h>using namespace std;const int maxn = 30;int n;vector <int> block[...

2018-02-13 20:20:45 132

原创 STL-D Where is the Marble? (UVA - 10474)

题目大意:  输入N个数,一共有Q次询问。  若询问的数在N个数之中,则输出其排序之后的位置。#include <stdio.h>#include <strings.h>#include <vector>#include <algorithm>using namespace std;int main(){ int N,Q,nu...

2018-02-13 20:18:03 155

原创 STL-B Parentheses Balance (UVA-673)

括号匹配问题--最开始的思路是用两个栈分别保存前括号 与 后括号 但是遇到了蜜汁编译错误...现在暂时不懂原因然后思路就是遇到前括号就直接压入栈中,对比栈顶与后一个括号是否匹配。若匹配,则弹出。最后检查栈里是否还有元素。#include <stdio.h>#include <stack>#include <string.h>using namespac...

2018-02-13 20:08:39 117

原创 STL-A ACboy needs your help again! (栈和队列)

ACboy needs your help again! 有 先进先出(队列) 和 先进后出 (栈)两种情况。#include <stack>#include <iostream>#include <stdio.h>#include <string.h>#include <queue>using namespace std;...

2018-02-13 19:19:04 158

空空如也

空空如也

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

TA关注的人

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