摘要: 最短路View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>#include <cmath>using namespace std;#define maxn 205struct Point{ double x, y;}point[maxn];double map[maxn][maxn];double subv, walkv;int n;double dist(Point &a, Point &b){ Point 阅读全文
posted @ 2011-10-02 21:12 undefined2024 阅读(292) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 400#define maxl 100char st[maxn][maxl];int n, m;int from[maxn];int to[maxn];int getid(char *a){ for (int i = 0; i < m; i++) if (strcmp(st[i], a) == 0) retu 阅读全文
posted @ 2011-10-02 15:00 undefined2024 阅读(164) 评论(0) 推荐(0)
摘要: 最短路View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxm 50005#define maxn 1005struct Edge{ int v, next;}edge[maxm * 2];int n, m;int head[maxn];int ecount;int from[maxn];int q[maxn];int stk[maxn];bool vis[maxn];void 阅读全文
posted @ 2011-10-02 14:06 undefined2024 阅读(211) 评论(0) 推荐(0)
摘要: 矩阵乘法View Code #define w 2005struct Matrix{ int x, y; int num[5][5]; Matrix(int xx, int yy) { x = xx; y = yy; for (int i = 0; i < x; i++) for (int j = 0; j < y; j++) num[i][j] = 0; }};Matrix operator*(Matrix numa, Matrix numb){ Matrix n... 阅读全文
posted @ 2011-10-02 13:14 undefined2024 阅读(190) 评论(0) 推荐(0)
摘要: 简单题View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;int n;int main(){ //freopen("t.txt", "r", stdin); while (scanf("%d", &n), n) { long long x = 0; while (x * 2 < n) x = x * 10 + 9; if ( 阅读全文
posted @ 2011-10-02 12:12 undefined2024 阅读(183) 评论(0) 推荐(0)
摘要: 先算0~a的各位数,再算b的,相减得结果View Code #include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;#define maxn 1005long long f[maxn], g[maxn];void cal(int a, long long *f){ if (a == 0) return; long long x = 10; while (x <= a * 10) { long long count 阅读全文
posted @ 2011-10-02 11:46 undefined2024 阅读(194) 评论(0) 推荐(1)