题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=115
算法分析:
单源最短路问题,spfa或者dijkstra算法
#include
#include
#include
#include
#include
using namespace std;
#define MAX_V 1005
#define INF 1e8
int cos...
分类:
其他好文 时间:
2015-04-23 15:41:42
阅读次数:
182
对队列不懂的 可以看看我转的这篇文章STL整理。#include
#include
using namespace std;
typedef struct
{
int rich,num;
}node;
queue s1;
priority_queue,less >s2;//把less换成greater就是从小到大
int main()
{
node t,v;
int n,m,x;
w...
分类:
其他好文 时间:
2015-04-22 18:25:21
阅读次数:
129
题目链接:298 点的变换 这题放在矩阵快速幂里,我一开始想不透它是怎么和矩阵搭上边的,然后写了个暴力的果然超时,上网看了题解后,发现竟然能够构造一些精巧的矩阵来处理,不得不说实在太强大了!http://blog.csdn.net/lyhvoyage/article/details/39755...
分类:
其他好文 时间:
2015-04-21 22:08:22
阅读次数:
171
题目连接:http://acm.nyist.net/JudgeOnline/problem.php?pid=973
算法分析:
spfa+负环判定
在传功的过程中如果因为f
#include
#include
#include
#include
#include
using namespace std;
const int MAXN=505;
const int INF=0x7...
分类:
其他好文 时间:
2015-04-21 18:03:19
阅读次数:
151
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=973
题目大意:给你n种武功,每两种武功都可以相互转化,但是有转化率f, 每次必须从一开始转化, 中间有武功转化不了, 后面的就不能在转化了, 问你能否可以无限增加转化。
在做这道题以前做了和这道题一样的一道题, 所以我认为很快就能AC了, 但是这道题我还是弄了一天还是没能AC。来讲一...
分类:
其他好文 时间:
2015-04-21 14:46:36
阅读次数:
205
blockhouses
时间限制:1000 ms | 内存限制:65535 KB
难度:3
描述 Suppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a...
分类:
其他好文 时间:
2015-04-21 09:54:39
阅读次数:
147
VF
时间限制:1000 ms | 内存限制:65535 KB
难度:2
描述
Vasya is the beginning mathematician. He decided to make an important contribution to the science and to become famous all over the world. But...
分类:
其他好文 时间:
2015-04-20 17:05:16
阅读次数:
128
题目链接原题地址
经典问题,该问题具有最有子结构性质和无后效性,可以用动态规划,也可以用记忆化搜索,代码如下:
#include
using namespace std;
#include
#include
#include
#include
#include
int d[][2] = {0,1,1,0,0,-1,-1,0};
int f[110][110];
int map[...
分类:
其他好文 时间:
2015-04-20 17:00:26
阅读次数:
85
//就想象成t行11列的数,从下往上遍历相加,找最大值。#include
#include
int dp[100005][13];
int Max(int a,int b,int c)
{
int max=a;
if(max<b)
max=b;
if(max<c)
max=c;
return max;
}
int main()
{
int n,x,t,max;
while(sc...
分类:
其他好文 时间:
2015-04-19 21:26:41
阅读次数:
149
素数环
时间限制:1000 ms | 内存限制:65535 KB
难度:2
描述
有一个整数n,把从1到n的数字无重复的排列成环,且使每相邻两个数(包括首尾)的和都为素数,称为素数环。
为了简便起见,我们规定每个素数环都从1开始。例如,下图就是6的一个素数环。
输入有多组测试数据,每组输入一个n(0
输出每组第一行输出对应的Case序号...
分类:
其他好文 时间:
2015-04-19 17:59:06
阅读次数:
162