
题解
Wildcatastrophe
这个作者很懒,什么都没留下…
展开
-
HDU 4771 Stealing Harry Potter's Precious
旅行商问题,状压dp 用一个二进制数表示是否走过当前的几个位置#include <stdio.h>#include <string.h>#include <iostream>#include <algorithm>#include <string>#include <math.h>#include <stdlib.h>using namespace std;int n,m;ch原创 2017-08-07 19:06:34 · 277 阅读 · 0 评论 -
POJ 3552
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int VM=110;const int INF=999999999;struct Edge{ int u,v; int cap;}edge[VM*VM];int n,m,ans,fa原创 2017-08-05 01:04:18 · 290 阅读 · 0 评论 -
二分图的多重最大匹配——网络流
hihoCoder1393秋季运动会HDU3605 Escape原创 2017-08-18 13:30:41 · 1548 阅读 · 0 评论 -
POJ2287 Tian Ji——The Horse Racing
POJ2287 田忌赛马原创 2017-08-17 18:11:14 · 485 阅读 · 0 评论 -
HDU 1159 Common Subsequence
最大公共子序列原创 2017-08-07 19:59:23 · 289 阅读 · 0 评论 -
博弈论(阶梯博弈)POJ 1704
阶梯博弈:博弈在一列阶梯上进行,每个阶梯上放着自然数个点。两个人进行阶梯博弈,每一步则是将一个集体上的若干个点( >=1 )移到前面去,最后没有点可以移动的人输原创 2017-08-05 23:21:23 · 470 阅读 · 0 评论 -
POJ 3922 A simple stone game(K倍减法游戏)
两人取一堆石子,石子有n个。 先手第一次不能全部取完但是至少取一个。之后每人取的个数不能超过另一个人上一次取的数的K倍。拿到最后一颗石子的赢。先手是否有必胜策略?若有,先手第一步最少取几个?原创 2017-08-05 22:40:49 · 433 阅读 · 0 评论 -
Codeforces 768B Code For 1 (简化版线段树)
#include<iostream>using namespace std;typedef long long ll;ll query(ll n,ll L, ll R ,ll l, ll r){ if(R<l||L>r||n==0) return 0; if(n==1)return 1; ll mid = (l+r)>>1; return qu原创 2017-08-07 19:43:49 · 379 阅读 · 0 评论 -
Codeforces 578C Weakness and Poorness
题目描述:给出一个数列,找出一个数x,使这个数列中每一个元素都减去x值所得的绝对值的和最小。 题目分析:当x非常大时,最终的答案值也会很大;当x为0时,一定可以找出一个大于0的值使每个元素减去它的答案值变小,因此这是一个三分题目。#include <cmath>#include <cstdio>#include <cstdlib>#include <cstring>#include <io原创 2017-08-07 19:36:32 · 352 阅读 · 0 评论 -
Gym 101194D Ice Cream Tower (双指针扫描)
这道题的重要方法之一是双指针扫描,它的时间复杂度只有O(N)/*双指针扫描*/#include<iostream>#include<algorithm>using namespace std;typedef long long ll;const int maxn = 300005;ll a[maxn],b[maxn];int t,T,n,k;bool judge(int x){原创 2017-08-07 19:30:13 · 490 阅读 · 0 评论 -
Codeforces 9C Hexadecimal‘s number (DFS)
给出一个数,判断不大于它的数中有多少个只由0,1组成// 这种方法针对只给出一个数据非常容易,仅仅是单纯的DFS#include<iostream>#include<stdio.h>#include<map>using namespace std;long long int ans = 0;map<int ,int >vis;int n;void DFS(int x){原创 2017-08-07 19:27:14 · 326 阅读 · 0 评论 -
POJ 1011 Sticks
用当前的木棍拼木棒,问能拼成x(x>=1)根等长木棒的最小长度是多少 首先考虑由最大的木棒开始拼,边界条件为所有木棍拼接成一根木棒,因此答案就在max~sum之间枚举。注意一个需要满足的性质是,木棒的总长度sum%当前长度len==0,因为要拼成整数个等长木棒,进行搜索即可#include<iostream>#include<algorithm>#include<cstring>using原创 2017-08-07 19:12:25 · 234 阅读 · 0 评论 -
POJ 3692 Kindergarten
bool find(int x){ int i,j; for (j=1;j<=m;j++){ //扫描每个被匹配的物体 if (line[x][j]==true && used[j]==false) //如果有联系并且还没有标记过(这里标记的意思是这次查找曾试图改变过该物体的归属问题,但是没有成功,所以就不用瞎费工夫了)原创 2017-08-05 02:27:31 · 286 阅读 · 0 评论