题目连接: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
表达式求值
时间限制:3000 ms | 内存限制:65535 KB
难度:3
描述
Dr.Kong设计的机器人卡多掌握了加减法运算以后,最近又学会了一些简单的函数求值,比如,它知道函数min(20,23)的值是20 ,add(10,98) 的值是108等等。经过训练,Dr.Kong设计的机器人卡多甚至会计算一种嵌套的更复杂的表达式。
假设表达式可以简单定义为:
...
分类:
其他好文 时间:
2015-04-19 08:57:54
阅读次数:
174
【题目链接】click here~~
【题目大意】已经
f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.求f(n),
【解题思路】:此题是大三届的一场比赛题,前几天做了下,结果是不忍直视啊,wa了几乎一页了,最开始想的是用矩阵快速幂,但是想了想,取模数才不到10,7
7=49,也就是说最大结果不超过49种可...
分类:
其他好文 时间:
2015-04-18 22:02:10
阅读次数:
154
Substring
时间限制:1000 ms | 内存限制:65535 KB
难度:1
描述
You are given a string input. You are to find the longest substring of input such that the reversal of the substring is also a substring of ...
分类:
其他好文 时间:
2015-04-17 18:24:31
阅读次数:
128