摘要:
http://poj.org/problem?id=1850题意:求所给字符串按照题目的编码规则,它的编码应是多少? 1 #include 2 #include 3 #define LL long long 4 5 double C(int a,int b)//计算组合数C(a,b) 6 { 7 if(a 0)11 {12 res*=(double)a--/(double)b--;13 }14 return res;15 }16 int main()17 {18 char s[120];19 while(~scanf("... 阅读全文
posted @ 2014-02-11 20:55
N_ll
阅读(154)
评论(0)
推荐(0)
摘要:
http://poj.org/problem?id=3020题意:一个矩形中,有N个城市'*',现在这n个城市都要覆盖无线,若放置一个基站,它至多可以覆盖相邻的两个城市。问至少放置多少个基站才能使得所有的城市都覆盖无线?无向二分图的最小路径覆盖 = 顶点数 – 最大二分匹配数/2 1 #include 2 #include 3 const int N=505; 4 int pos[N][N],map[N][N]; 5 int link[N]; 6 bool vis[N]; 7 int dir[4][2] = {{0,-1},{0,1},{1,0},{-1,0}}; 8 int 阅读全文
posted @ 2014-02-11 19:07
N_ll
阅读(185)
评论(0)
推荐(0)
摘要:
http://poj.org/problem?id=3274***** 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const int N=100001; 7 const int MOD=99991; 8 int Maxdis,k; 9 int c[N][32],sum[N][32];10 int vis[N][32];11 12 struct node13 {14 int row_i;15 struct node *next;16 }*hash[N];17 bool cmp(... 阅读全文
posted @ 2014-02-11 16:27
N_ll
阅读(165)
评论(0)
推荐(0)
摘要:
http://poj.org/problem?id=3007第一次用STL做的,TLE了,自己构造字符串哈希函数才可以。。TLE代码: 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int main() 8 { 9 int n;10 scanf("%d",&n);11 while(n--)12 {13 int cnt = 0,j;14 char ss[120];15 string str,s,... 阅读全文
posted @ 2014-02-11 16:17
N_ll
阅读(169)
评论(0)
推荐(0)

浙公网安备 33010602011771号