自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(99)
  • 收藏
  • 关注

原创 POJ 2282 数位dp

#include #include #include const int maxn = 12;int A[maxn], B[maxn], a, b;void Fun(int *L, int n, int m){ int x = n / 10, y = n % 10, tmp = x; for (int i = 0; i <= y; i++) L[i] += m; for (int

2016-03-31 22:22:23 425

原创 POJ 3070 矩阵快速幂

#include #include using namespace std;const int MOD = 10000;int n;struct matrix{ int m[2][2];} ans, base;matrix multi(matrix a, matrix b){ matrix tmp; for (int i = 0; i < 2; ++i)

2016-03-31 21:49:16 272

原创 POJ 3090 欧拉函数

#include #include const int maxn = 1010;int phi[maxn], T, n, kase;void init(){ memset(phi, 0, sizeof(phi)); for (int i = 2; i < maxn; i++) if (!phi[i]) for (int j = i; j < maxn; j += i)

2016-03-31 18:05:48 281

原创 POJ 1811 Miller_Rabin算法Pollard_Rho算法

#include #include #include #include #include using namespace std;typedef long long LL;LL gcd(LL A, LL B){ if (!A) return 1; if (A < 0) A = -A; return B == 0 ? A : gcd(B, A % B);}LL MultMo

2016-03-30 22:18:59 389

原创 POJ 2689 区间素数

#include #include const int maxn = 1E6 + 10;int prime[maxn], primeLR[maxn], A, B;bool vis[maxn];void GetPrime(){ memset(prime, 0, sizeof(prime)); for (int i = 2; i <= maxn; i++) { if (!prim

2016-03-30 21:56:38 381

原创 POJ 2891 扩展欧几里得

#include typedef long long LL;LL n, a1, a2, r1, r2, d, x, y;LL ex_gcd(LL a, LL b, LL &x, LL &y){ if (b == 0) {x = 1; y = 0; return a;} LL d = ex_gcd(b, a % b, y, x); y -= a / b * x; return d;

2016-03-29 22:23:04 280

原创 HDU 4465 快速全排列

#include #include const int maxn = 4E5 + 10;int n, kase;double fun[maxn] = {0}, p;void init(){ for (int i = 1; i < maxn; i++) fun[i] = fun[i - 1] + log(i);}double C(int m, int n){ return

2016-03-29 19:51:36 442

原创 HDU 2147 博弈

#include int n, m;int main(int argc, char const *argv[]){ while (~scanf("%d%d", &n, &m) && n + m) printf("%s\n", (n & 1 && m & 1) ? "What a pity!" : "Wonderful!"); return 0;}巴什博弈,把PN状态图画

2016-03-29 17:53:32 304

原创 HDU 1850 NIM博弈

#include const int maxn = 1E2 + 10;int inp[maxn], m, sum, cnt;int main(int argc, char const *argv[]){ while (~scanf("%d", &m) && m) { sum = cnt = 0; for (int i = 0; i < m; i++) scanf("%d"

2016-03-29 17:41:24 370

原创 HDU 4642 简单博弈

#include int n, m, T, tmp;int main(int argc, char const *argv[]){ scanf("%d", &T); while (T--) { scanf("%d%d", &n, &m); for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) scanf("

2016-03-29 16:51:23 371

原创 HDU 4764 博弈

#include int n, k;int main(int argc, char const *argv[]){ while (~scanf("%d%d", &n, &k) && n + k) printf("%s\n", (n - 1) % (k + 1) == 0 ? "Jiang" : "Tang"); return 0;}

2016-03-29 16:40:19 272

原创 HDU 4609 FFT

挖坑待填http://blog.csdn.net/acm_cxlove/article/details/9466063

2016-03-29 16:24:59 426

原创 HDU 5322 NTT与分治

挖坑代填。

2016-03-29 16:22:44 401

原创 HDU 1402 FFT

#include using namespace std;typedef complex CPX;const int maxn = 2E5 + 10;const double PI = acos(-1);char s1[maxn], s2[maxn];int ans[maxn];void FFT(vector&A, int op){ int n = A.size(); for

2016-03-29 16:15:58 310

原创 HDU 1695 容斥原理

#include #include #include #include #include using namespace std;const int maxn = 1E5 + 10;std::vector v[maxn];int T, A, B, C, D, K, kase;void init(){ for (int i = 2; i < maxn; i += 2) v[i]

2016-03-28 23:23:04 269

原创 HDU 5072 容斥原理

#include #include #include #include using namespace std;const int maxn = 1E5 + 10;int T, N, X, inp[maxn], tol[maxn];std::vector v;vector& GetPrimefun(long long n){ v.clear(); for (long long

2016-03-28 21:54:37 262

原创 HDU 2841 容斥原理

#include #include #include using namespace std;int T, n, m;const int maxn = 1E5 + 10;std::vector prime[maxn];void init(){ for (int i = 2; i < maxn; i++) if (!prime[i].size()) for (int j

2016-03-28 20:21:20 301

原创 HDU 4135 容斥原理

#include #include #include #include #include using namespace std;long long T, A, B, N, kase;vector GetPrimefun(long long n){ std::vector v; for (long long i = 2; i * i <= n; i++) if (n % i

2016-03-28 19:56:30 246

原创 SGU 414 圆的正交

#include #include #include #include #include using namespace std;const int maxn = 1E5 + 10;int kase, T, n;struct Point{ double x, y; Point(double x = 0, double y = 0): x(x), y(y) {}};typ

2016-03-26 16:54:05 362

原创 POJ 3254 状压dp

#include #include #include #include #include using namespace std;const int maxn = 1 << 12 + 10;const int MOD = 1E8;int dp[15][maxn], mp[15][15], n, m;std::vector vec[15];int fun(int x){ in

2016-03-24 21:06:18 223

原创 POJ 2253 最短路

#include #include #include #include using namespace std;const int maxn = 200 + 5;int n, kase;double dis[maxn][maxn], X[maxn], Y[maxn];void floyd(){ for (int k = 1; k <= n; k++) for (int i

2016-03-23 22:00:05 258

原创 HDU 2680 最短路

#include #include #include using namespace std;const int INF = 0x3f3f3f3f;const int maxn = 1010;int num, road, dest, mp[maxn][maxn], dis[maxn], x, y, cost, tmp, cnt;bool vis[maxn];void Dijkstr

2016-03-23 21:39:31 269

原创 HDU 1829 并查集

#include #include #include using namespace std;const int maxn = 2005;int fa[maxn * 2], mk, T, kase, n, x, y, m;void init(int n){ for (int i = 0; i < maxn + n; i++) fa[i] = i; mk = 1;}int

2016-03-23 16:59:00 296

原创 POJ 1861 最短路

#include #include #include #include using namespace std;const int maxm = 15010;const int maxn = 1010;int n, m, fa[maxn];struct Edge{ int s, t, w; Edge(int a = 0, int b = 0, int c = 0): s(a)

2016-03-22 21:52:49 286

原创 codeforce 437D 并查集+贪心

#include #include #include using namespace std;const int maxn = 1E5 + 10;int x, y, m, n, fa[maxn], sz[maxn];double val[maxn];int find(int x){ return x == fa[x] ? x : fa[x] = find(fa[x]);}st

2016-03-22 21:10:27 330

原创 HDU 3074 带权并查集

#include #include #include using namespace std;const int maxn = 5E4 + 10;int f[maxn], a, b, x, n, m, Rank[maxn];void init(){ for (int i = 0; i <= n; i++) f[i] = i, Rank[i] = 0;}int find(in

2016-03-22 20:34:56 216

原创 HDU 1043 搜索 A*算法

#include #include #include #include #include #include using namespace std;const int maxn = 4E5 + 10;const int mlen = 30;char str[mlen], D[] = "udlr";int ha[9] = {1, 1, 2, 6, 24, 120, 720, 50

2016-03-22 19:40:22 429

原创 HDU 4766 模拟退火(最小圆覆盖) + 二分

#include #include #include #include #include #include const int maxn = 1E3 + 10;using namespace std;struct Point{ double x, y; Point(double x = 0, double y = 0): x(x), y(y) {}};typedef Po

2016-03-19 22:31:24 590

原创 ZOJ 3913 球缺

#include using namespace std;const int maxn = 1e5 + 10;const double pi = acos(-1.0);const double eps = 1e-10;struct circle{    double h, r;    void input()    {        scanf("%lf%l

2016-03-19 16:57:56 413

原创 Codeforce 327D 二分

#include #include #include #include #include using namespace std;const double eps = 1e-7;double X1, Y1, X2, Y2, Vmax, t, Vx1, Vy1, Vy2, Vx2;bool check(double mid){ double X = X2, Y = Y2, D =

2016-03-19 16:40:49 436

原创 POJ 2098 数值积分

#include #include #include #include const double eps = 1E-6;int T;double a, b, l, r;// simpson公式用到的函数double F(double x){ return sqrt(b * b * (1 - x * x / (a * a)));}// 三点simpson法。这里要求F是一个全

2016-03-18 21:42:25 413

原创 HDU 5531 几何公式

#include #include #include #include using namespace std;const int maxn = 1e4 + 5;const double INF = 1e20;const double PI = acos(-1);const double eps = 1e-8;struct Point{ double x, y;

2016-03-18 21:40:31 321

原创 POJ 1263 简单几何?!

#include #include #include #include #include #include using namespace std;const double DINF = 1E100;struct Point{ double x, y; Point(double x = 0, double y = 0): x(x), y(y) {}};typedef Po

2016-03-18 20:16:56 444

原创 POJ 2354 大地坐标系

#include #include #include const int maxn = 100;char str[maxn];double d, m, s, L1, L2, D1, D2;double Dis(double l1, double d1, double l2, double d2){ double r = 6875.0 / 2; double p = a

2016-03-17 21:07:01 499

原创 POJ 3525 半平面交

#include #include #include #include #include using namespace std;struct Point{ double x, y; Point(double x = 0, double y = 0): x(x), y(y) {}};typedef Point Vector;typedef vector Polygon;V

2016-03-17 20:19:40 301

原创 POJ 2002 哈希

#include #include #includeusing namespace std;const int prime = 100007;int Hash[prime + 5];int Next[prime + 5];int n, X1, X2, Y1, Y2;struct Point{ int x, y;} P[1005];void insert(int x, int

2016-03-17 19:49:09 303

原创 POJ 1654 几何基础

#include #include #include using namespace std;const int maxn = 1E6 + 10;int dx[10] = {0, 1, 1, 1, 0, 0, 0, -1, -1, -1};int dy[10] = {0, -1, 0, 1, -1, 0, 1, -1, 0, 1};char str[maxn];long long

2016-03-17 16:57:48 251

原创 POJ 3675 三角剖分

#include #include #include #include #include using namespace std;struct Point{ double x, y; Point(double x = 0, double y = 0): x(x), y(y) {}};typedef Point Vector;typedef vector Polygon;P

2016-03-17 16:28:03 435

原创 uva 11978 二分和三角剖分

#include#include#include#include#include#define double long doubleusing namespace std;const double PI = acos(-1.0);const double eps = 1e-10;struct Point{ double x, y; Point(double x

2016-03-17 15:58:20 297

原创 POJ 1696 卷包裹算法

#include #include #include #include #include #include #include using namespace std;const int maxn = 100 + 10;struct Point{ double x, y; Point(double x = 0, double y = 0): x(x), y(y) {}};

2016-03-16 16:51:34 458

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除