自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

MrFox

高效 极致 口碑 快

  • 博客(95)
  • 收藏
  • 关注

原创 还是优秀的人能够欣赏这个世界的美好

寒假来了, 不多说,就是干;

2016-01-21 19:08:30 536

原创 HDU 2337

二分+bfs:#include#include#include#include#include#include#includeusing namespace std;typedef pair PII;#define xx first#define yy secondconst int maxn = 1000 + 5;const int dx[] = {-1, 0, 1,

2015-11-26 09:56:03 472

原创 UVA 1213 Sum of Different Primes

#include#include#include#includeusing namespace std;const int maxn = 1120 + 5;bool prime[maxn];vector res;void init(){    memset(prime,0,sizeof(prime));    for(int i = 2; i     f

2015-10-08 18:48:29 452

原创 UVA 10118 Free Candies

//开始以为是个数塔。。。//记忆化搜索:dp[a][b][c][d]的意义是第一堆选了a, 第二堆选了b个, 。。。。。之后剩下的最大值;#include#include#include#include#includeusing namespace std;const int maxn = 40 + 5;int vis[maxn][4];int dp[maxn][maxn

2015-09-21 19:34:01 447

原创 UVA - 11134 Fabled Rooks

#include#include#include#include#includeusing namespace std;const int maxn = 5000 + 5;struct node{ int x1, x2, y1, y2; int id;}k[maxn];int x[maxn];int y[maxn];bool cmp1(node p, nod

2015-09-10 15:47:20 391

原创 HDU 5135 Little Zu Chongzhi's Triangles

//状态压缩:#include #include #include #include #include #include using namespace std; const int maxn = (1<<13) - 1; int n; double dp[maxn]; int res[13]; vectorv; double area(int

2015-09-09 10:51:01 448

原创 UVA 12569 Moving Pegs

没解决,状压只是懂意思,理解还得下苦功。

2015-09-08 15:49:02 442

原创 UVA 818 Cutting Chains

//没解决 很牛逼的二进制枚举 判断成环 //需要补充二进制枚举的题目

2015-09-07 10:47:11 608

原创 UVA 211 The Domino Effect

//水回溯//普及一下知识 Domino (多米诺), 两个Pips确定一张Bone

2015-09-06 16:59:25 443

原创 UVA 120 Stacks of Flapjacks (STL deque&reverse)

#include#include#include#include#include#include#include#includeusing namespace std;deque res;int Is_order(){ for(int i = 0; i < (int)res.size() - 1;++i) if(res[i] > res[i+1]

2015-09-02 10:56:04 446

原创 ACM/ICPC 14 北京站现场赛 B

// dfs回溯 + 估价函数#include #include #include #include #include using namespace std; const int maxn = 5 + 5; int res[maxn][maxn]; int cnt[maxn * maxn]; int n, m, k; int flog; int o

2015-09-02 09:39:41 442

原创 UVA 1149 Bin packing

//重做这个题完全是为了使用res.erase();以前比赛的时候基本不敢用, 事实证明是可以A题的;不能res.erase(res.end());不知为何。。。#include#include#include#include#include#includeusing namespace std;vector res;int main(){ int n;

2015-09-01 20:40:32 427

原创 UVA 1612 Guess

注意精度问题;set里面的count是不能避免精度问题的;

2015-09-01 19:30:06 462

原创 SDKD Summer Team Contest X ACM/ICPC 14 北京站现场赛

//话说今天又有场上看题解的, 真TMD的恶心;A:水题, 不必多说;B:其实是可以构造的, 这个题场上没出1、颜色排序, 按最多, 最少, 次多, 次少填入。另外, 先奇数,不行再偶数;队友后来补的构造:#includeusing namespace std;int num[60];struct xx{ int ID,num; bool oper

2015-08-31 21:13:18 398

原创 UVA 1152 4 Values whose Sum is 0

//核心是学长的一个牛逼的hash标记。看到了学长们去年的态度, 自愧不如。#include#include#include#include#includeusing namespace std;const int maxn = 4000 + 5;struct Hash_map{ static const int mask = 0x7fffff; int p[8

2015-08-31 09:30:47 440

原创 收藏DP题目

HDU:点击打开链接

2015-08-31 09:16:17 555

原创 UVA 1605 Building for UN

#include#include#include#include#includeusing namespace std;char s[] = {'0', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S','T', 'U', 'V', 'W','X',

2015-08-29 09:57:06 424

原创 HDU 1171 Big Event in HDU

//加油!#include#include#include#include#includeusing namespace std;const int maxn = 250000 + 5;int dp[maxn];int cnt[5000+5];int main(){ int n; while(scanf("%d", &n) == 1 && n > 0)

2015-08-28 09:32:32 407

原创 HDU 1203 I NEED A OFFER!

//加油!#include#include#include#include#includeusing namespace std;const int maxn = 10000 + 5;struct node{ int n; double p;}res[maxn];double dp[maxn];int main(){ int n, m;

2015-08-27 09:38:30 400

原创 HDU 2602

//加油!#include#include#include#include#includeusing namespace std;const int maxn = 1000 + 5;int dp[maxn];int w[maxn];int v[maxn];int main(){ int T, N, V; cin >> T; while(T--)

2015-08-27 08:54:30 340

原创 HDU 2955 Robberies

//加油!#include#include#include#include#include#include#includeusing namespace std;const int maxn = 10000 + 5;double dp[maxn];struct node{ int w; double p;}res[maxn/100];int main(

2015-08-27 08:40:21 403

原创 HDU 1166 敌兵布阵

#include#include#include#include#includeusing namespace std;const int maxn = 50000 + 5;int v[maxn];struct node{ int left, right, sum; node (int left = 0, int right = 0, int sum = 0) :

2015-08-25 10:36:07 367

原创 HDU - 1166 敌兵布阵

#include#include#include#include#include#include#include#includeusing namespace std;const int maxn = 50000 + 5;int bit[maxn], n;int sum(int i){ int s = 0; while(i>0) {

2015-08-25 09:14:47 284

原创 SDKD Summer Team Contest S

F:点击打开链接最小生成树;#include#include#include#include#include#include#includeusing namespace std;const int maxn = 1e5 + 100;int p[maxn];int r[maxn];int F[maxn];struct node{ int u, v, c;

2015-08-24 19:34:27 465

原创 SDKD Summer Team Contest R

H: 点击打开链接回家了一个周,回来看的这个题。这个题队内的AC率极高。说说我看到的这个题。我有这个看题解的习惯,一看完题,我就没有啥思路。然后看到这么多人都A了。直接去看题解。恩我如果场上做的话应该也能想到是贪心, 但第一反应应该是这个题是不是DP,所以说贪心和DP有时候很容易搞混。但他俩的复杂程度是完全不一样的。这个题就是贪心,思路也就那样。PS:队里的直接在场上就贴代码的

2015-08-21 20:14:00 405

原创 UVA - 208 Firetruck

//非常水的一道回溯题, 只是输出问题醉了, 题目里的输出不是AC的输出格式;#include#include#include#include#includeusing namespace std;const int maxn=20 + 5;int res[maxn][maxn];int par[maxn];int r[maxn];int used[maxn];vecto

2015-08-11 21:19:49 344

原创 SDKD Summer Team Contest K

A:签到题, 还是很恶心的点击打开链接#include using namespace std;int main (){ double a[15]; int n; cin>>n; while(n--) { double sum=0; for(int i=0;i<12;i++) {

2015-08-11 19:24:55 325

原创 SDKD Summer Team Contest K

//比赛用的别人的账号, 只说题意。D:点击打开链接F:点击打开链接

2015-08-11 19:18:09 377

原创 UVA - 12186 Another Crisis

//树形DP,新技能get!核心代码是书上的。。#include#include#include#include#includeusing namespace std;const int maxn=1e5 + 5;vector sons[maxn];int n, T;int dp(int u){ if(sons[u].empty()) return 1; i

2015-08-11 10:08:30 391

原创 UVA - 11582 Colossal Fibonacci Numbers!

//数学题就是很考验思维的灵活性。。有收获,长见识。#include#include#include#include#includeusing namespace std;const int maxn = 1000 + 5;vector v[maxn];unsigned long long a, n, mod;void init(){ for(int i = 2;

2015-08-11 09:26:54 332

原创 SDKD Summer Team Contest I

A:点击打开链接#include#include#includeusing namespace std;int main(){ int T; cin >> T; while(T--) { int n, m; cin >> n >> m; string ss; cin >> ss;

2015-08-10 10:26:12 319

原创 Editing string

这几天做题碰到了好几道剪辑字符串的题目,自己写了个代码, 背过直接用。#include#include#include#includeusing namespace std;int main(){ string s; cin >> s; int n = (int)s.size(); for(int i = 0; i < n; ++i) {

2015-08-07 10:47:51 318

原创 UVA - 10003 Cutting Sticks

//比较巧妙, 不看书也写不出来应该。。#include#include#include#includeusing namespace std;const int maxn = 50 + 5;const int inf = 100000000;int v[maxn];int dp[maxn][maxn];int d(int l, int r){ if(l >= r-

2015-08-07 10:11:38 308

原创 UVA - 11584 Partitioning by Palindromes

DP:#include#include#include#includeusing namespace std;const int maxn = 1000 + 5;char s[maxn];int d[maxn];int solve(int a, int b){ while(a<b) { if(s[a] != s[b]) return 0;

2015-08-06 10:57:03 332

原创 SDKD Summer Team Contest F

A:点击打开链接概率题, 果断打破了我只靠记忆化搜索的思想;#include #include #include #include using namespace std;double dp[205], t[205];int n, m, l, r, step;void init(){ memset(dp, 0, sizeof(dp)); memset(t,

2015-08-06 08:46:49 253

原创 SDKD Summer Team Contest E

I:点击打开链接#include#include#include#include#includeusing namespace std;int main(){ double dis = 0; int T; cin >>T; while(T--) { int n; cin >> n; doubl

2015-08-04 20:11:28 395

原创 SDKD Summer Team Contest D

E:点击打开链接记忆化搜索, 主要是开始和结束的时候比较难控制;然后记忆化搜索有时候比DP好像很多,而且剪枝方便;#include#include#include#include#includeusing namespace std;const int maxn = 50 + 5;const int maxd = 10000 + 5;vector res[maxn];in

2015-08-04 20:09:35 415

原创 SDKD Summer Team Contest C

E:点击打开链接开始的时候a.s = s;错误;结构体排序忘了,用的冒泡,各种不爽啊当时;#include#include#include#include#include#includeusing namespace std;const int maxn = 200 + 5;struct person{ char s[55]; int kill;

2015-08-04 20:05:11 346

原创 SDKD Summer Team Contest B

A:点击打开链接暴力,随机分到的队友代码能力比较强,最后我提供了思路,他实现了。#includeusing namespace std;string s, ss;bool could(int l1, int l2){ for(int i =0;i<l1+l2;++i){ if(s[i]!=s[i+l1+l2]) return false; }

2015-08-04 19:59:07 276

原创 SDKD Summer Team Contest A

有五场组队赛了, 做的基本都是区域赛的题, 基本上每场出一两道,写一下自己做过的题。A:点击打开链接因为不是用我的账号交的,就不上代码了。开始队友一直在调试, 可能是因为怕浮点数有精度问题吧。a/b > c/d = a*d > b*c;不存在精度问题,1A;I:点击打开链接当时根本就没认真读, 没出。后来看了看,太水。所以说赛场不能放弃与懈怠,别人出的题更要慢慢看。因为水平

2015-08-04 19:55:46 376

空空如也

空空如也

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

TA关注的人

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