import re -- 所有正则表达式相关的功能都包含在re模块中re.sub() -- 字符串替换>>> import re>>> s= "100 NORTH BROAD ROAD">>> re.sub('ROAD$','RD.',s)'100 NORTH BROAD RD.'>>> s = "...
分类:
编程语言 时间:
2015-05-06 15:04:07
阅读次数:
185
Making the Grade
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 4647
Accepted: 2202
Description
A straight dirt road connects two fields on FJ's farm, b...
分类:
其他好文 时间:
2015-05-06 00:01:54
阅读次数:
147
最短路+拓扑序DP orz zyf & lyd 统计每条边在多少条最短路径上……其实可以统计 有多少条最短路径经过了x,以及y出发到达任意一个结束点有多少种走法(沿最短路) 我们可以用Dijkstra求出以 i 为起点的最短路径图,它是一个DAG,然后我们用dij扩展的顺序(一个拓扑序)来搞D...
分类:
其他好文 时间:
2015-05-05 23:44:33
阅读次数:
178
Description
AME decided to destroy CH’s country. In CH’ country, There are N villages, which are numbered from 1 to N. We say two village A and B are connected, if and only if there is a road betwe...
分类:
其他好文 时间:
2015-05-03 20:38:31
阅读次数:
149
题意:N个城市,m条道路需要建设,每条道路由某个公司负责并花费一定的费用,每个公司会向国家纳税,若公司A造1到2的路,B造2到3的路,那么就说A和B有联系。求国家能得到的钱的最大值。ans=纳税之和-建路花费之和。
思路:做最大权闭合图的题就是要找到有相互依赖关系的两个集合。题目中告诉了公司之间有依赖关系,那么就以公司为节点,源点和每个公司连边权为纳税,公司和会点连边权为花费,公司与公司之间有联系的连边权为INF。...
分类:
其他好文 时间:
2015-05-03 09:24:03
阅读次数:
120
最小生成树kruskal算法。
首先必须形成一棵最小生成树,然后找出最长的路。
#include
#include
#include
#include
#include
#include
#include
using namespace std;
int n,m,a,b,c,par[1005],rankk[1005], max_road;
struct edge {
int u,v,c...
分类:
其他好文 时间:
2015-05-01 12:08:49
阅读次数:
147
Ladies and gentlemen, Good evening.I'd rather use english, not mandarin.Because during the road show, I felt so sorry.When I opened my mouth I have to...
分类:
其他好文 时间:
2015-05-01 10:33:26
阅读次数:
168
Problem Description
Ant Country consist of N towns.There are M roads connecting the towns.
Ant Tony,together with his friends,wants to go through every part of the country.
They intend to visit every road , and every road must be visited for exact one t...
分类:
其他好文 时间:
2015-04-27 13:22:54
阅读次数:
148
The road to success was trial and error development, recompilation, and lots of crashes.寒假过去一个月,计划很多时候也没法跟上。不过总体上来说,还是学习和收获了一些东西的。过去的事情不能改变,所以也不必过于纠结和...
分类:
其他好文 时间:
2015-04-27 01:54:21
阅读次数:
175
题意:已知无向图,问添加最少的边使之成为边双连通图
思路:显然先缩点成一棵树,添加最少边使一棵树的边双连通
此处有结论:对于一棵树添加(1+leaf)>>1 条无向边就能构造成一个双连通图,构造方法显然(脑补一下
//216K 63MS C++ 1754B
#include
#include
#include
#include
...
分类:
其他好文 时间:
2015-04-24 09:09:05
阅读次数:
118