Going from u to v or from v to u?
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 15196
Accepted: 4013
Description
In order to make their sons brave, Jiaji...
分类:
编程语言 时间:
2015-04-27 18:27:18
阅读次数:
199
Greg has a weighed directed graph, consisting of n vertices. In this graph any pair of distinct vertices has an edge between them in both directions. Greg loves playing with the graph and now he has in...
分类:
其他好文 时间:
2015-04-27 15:17:42
阅读次数:
112
题目1 : 扑克牌时间限制:2000ms单点时限:1000ms内存限制:256MB描述一副不含王的扑克牌由52张牌组成,由红桃、黑桃、梅花、方块4组牌组成,每组13张不同的面值。现在给定52张牌中的若干张,请计算将它们排成一列,相邻的牌面值不同的方案数。牌的表示方法为XY,其中X为面值,为2、3、4...
分类:
编程语言 时间:
2015-04-27 12:51:20
阅读次数:
203
分析:同时计算最短距离和花费,距离相同时还要更新费用,还要同时存储正向边和反向边。
注意:不能用cin和cout,否则会超时。
#include
#include
using namespace std;
int u[200002];
int v[200002];
int w[200002];
int p[200002];
bool vis[1001];
int d[1001];
i...
分类:
编程语言 时间:
2015-04-27 10:02:30
阅读次数:
206
数独的美丽,哈密顿圈,货郎担回路,竟然是一路相通 问题...
分类:
其他好文 时间:
2015-04-27 09:59:57
阅读次数:
638
事实上在很多时候,例如写论文,例如写报告,例如做ppt,都需要花很多很多曲线图,让人家信服
毕竟数据可视化是人的本能。
假如读者您很不幸,像我一样不会用matlab之类的东西画图或者没办法用matlab画图,那么可以稍微关注一下python,因为python里面有很强大的库matplotlib,让用户直接用terminal就可以做大部分matlab画图能做的事情。
matplotlib的安装,可...
分类:
编程语言 时间:
2015-04-27 09:52:23
阅读次数:
232
分析:模版题,直接套用模版即可。
#include
#include
using namespace std;
int u[2002];
int v[2002];
int w[2002];
bool vis[202];
int d[202];
int first[202];
int Next[2002];
void Init(int n,int m)
{
int i;
...
分类:
其他好文 时间:
2015-04-27 09:50:06
阅读次数:
87
Description
Input
Output
Sample Input
4 4
1 2 3 4
Sample Output
4
HINT
Source
NCPC 2014
#include
#include
#include
using namespace...
分类:
编程语言 时间:
2015-04-26 19:48:33
阅读次数:
273
一道简单的图论题,不过穿上了很好的外衣,实质就是一个任意两点间最短路问题,比较适合用Floyd算法
#include
#include
using namespace std;
const int INF = 100000;
int n,m,t,d[305][305],a[305];
int main() {
scanf("%d%d",&n,&m);
for(int i=1;i<...
分类:
其他好文 时间:
2015-04-26 18:24:49
阅读次数:
177
题意:有一个起始站点,从这里送n个学生去其余的n-1个站点邀请人们去CSS,然后再返回CSS,使得总的花费最小。注意每次只能送一个,返回时每次也只能送一个,而且每条路是单向的。
分析:这相当于一个有向图,我们只需两次调用SPFA算法即可,第一次求出初始站点(在这里是1)到其它所有站点的最小花费,然后相加;第二次将图反向建立,即所有的边反向,再求出初始站点(这里是1)到其它站点的最小费用,之后相加...
分类:
编程语言 时间:
2015-04-26 16:46:25
阅读次数:
213