摘要:
枚举 + 二分,代码写得挫!#include <stdio.h>#include <string.h>#include <stdlib.h>#include <math.h>typedef __int64 LL;LL x, y, z, D, S;LL k;int main(){ int i, j; while(scanf("%I64d", &k), k) { S = 0; for(D = 1; D < k / 2; D <<= 1, S ++); bool flag1, flag2; LL a, b,
阅读全文
posted @ 2012-09-15 11:06
找回失去的
阅读(230)
推荐(0)
编辑
摘要:
求s到e经过n条边的最短路,看了08年国家集训队.俞华程的论文《矩阵乘法在信息学中的应用》,其中讲到图的邻接矩阵k次方后,a[i][j]可以表示i到j经过n-1个点的一条路径,结合floyd就能求出我们所需要的结果。/*Accepted 2060K 172MS C++ 1608B 2012-09-15 10:38:47*/#include <stdio.h>#include <string.h>#include <stdlib.h>const int MAXN = 1 << 10;const int MAXD = 105;int hash[MAX
阅读全文
posted @ 2012-09-15 10:52
找回失去的
阅读(237)
推荐(0)
编辑