题目链接Polya计数入门题10294 Arif in Dhaka (First Love Part 2)Our hero Arif is now in Dhaka (Look at problem 10244 – First Love if you want to know more about
Arif, but that information is not necessary for th...
分类:
其他好文 时间:
2015-05-06 17:43:31
阅读次数:
135
Basic remainsinput: b p m 读入p进制的p,m, 求p%m ,以b进制输出 1 import java.util.*; 2 import java.math.*; 3 import java.io.*; 4 import jav...
分类:
编程语言 时间:
2015-05-05 23:35:00
阅读次数:
177
戳这里:HDU 4004//思路:二分经典入门题...贪心判方案是否可行 1 #include "bits/stdc++.h" 2 using namespace std; 3 int L, n, m; 4 int pos[500010], dis[500010]; 5 6 bool Cant(i....
分类:
其他好文 时间:
2015-05-04 01:06:17
阅读次数:
180
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2571
常规dp,刚好让我这菜鸟来找找 找状态转移方程的感觉。。
定义dp[i][j] 表示的是第i行j列所拥有的最大的幸运值。
dp[i][j] 由三种情况转移而来:1、从上面一个坐标转移而来,即dp[i-1][j] 。2、由左边转移过来,即dp[i][j-1]。3、由他同一行中的 j 的因数...
分类:
其他好文 时间:
2015-04-30 16:12:17
阅读次数:
101
iddfs入门题。
//poj 3134
//sep9
#include
using namespace std;
int n,deep;
int a[30];
bool iddfs(int pos)
{
int t;
if(pos>deep) return false;
if(a[pos]<<(deep-pos)<n) return false;
if(a[pos]==n) ret...
分类:
其他好文 时间:
2015-04-29 11:38:56
阅读次数:
179
题目链接:http://poj.org/problem?id=3264
题目大意:n个数,求区间[ L,R ]的最大最小值之差;
题目分析:
RQM:dp[ i ][ j ], i开始长度为2^j的长度的区间最值;
O(nlog n)的预处理区间值,O(1)的查询;
代码:
//author: ACsorry
//result: accept
#include
#inclu...
分类:
其他好文 时间:
2015-04-28 22:56:11
阅读次数:
156
分析:最大流的入门题,BFS寻找增广路,找到则更新流量,直到找不到增广路为止。
#include
#include
using namespace std;
#define N 202
#define MAX 0x7fffffff;
class Max_Flow_EK
{
public:
Max_Flow_EK(){}
~Max_Flow_EK(){}
int Run(int n,in...
分类:
编程语言 时间:
2015-04-28 18:35:06
阅读次数:
187
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2222
题目大意:给n个模板串,求长串中模板串的个数;
解题思路:
自动机入门题,注意模板重复串。
代码:
#include
#include
#include
#include
#include
#include
#include
#include
#include...
分类:
其他好文 时间:
2015-04-26 09:21:47
阅读次数:
157
题目:
Lost Cows
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 9727
Accepted: 6261
Description
N (2 <= N <= 8,000) cows have unique brands in the range...
分类:
其他好文 时间:
2015-04-25 21:18:25
阅读次数:
130
【题目链接】:click here~~
【题目大意】:已知某几条道路已经修完,求全部道路要通路的最小花费
【解题思路】:基础的Kruskal算法了,按照边的权值从小到大排序一遍,符合条件加入到生成树中
代码:
/*
Author:HRW
kruskal+并查集
*/
#include
using namespace std;
const int max_v=105;
const int...
分类:
编程语言 时间:
2015-04-25 10:45:48
阅读次数:
208