自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

utoppia is another word .

为超越而战!

  • 博客(240)
  • 资源 (1)
  • 收藏
  • 关注

原创 模板,凸包

int TuBao(P p[],int n,P q[]){ int m = 0; sort(p,p+n); for(int i=0;i<n;++i) { while (m>1 && dcmp(cross(q[m-2],q[m-1],p[i]))<=0) m--; q[m++] = p[i]; } int k = m;

2014-04-30 10:24:45 619

原创 HDU 1817 , POJ 1286

polya // hdu 1817 poj 1286// by utoppia// polya#includetypedef long long ll;ll pow(ll a,int n) { ll ret = 1ll; while(n--) ret *= a; return ret;}int gcd(int a,int b) { retur

2014-04-22 16:16:57 855

原创 模板,扩展,离散对数,数论

扩展版的离散对数基本思路还是基于Shank的大小步算法(Shank's Baby-St

2014-04-22 12:01:13 717

原创 模板,FFT 快速傅里叶变化

大神的模板。。

2014-04-21 20:17:32 4557

原创 CSU 1416 Practical Number 很有意思的数学题

基本上就是一个结论题,然后wiki一下就出了// csu 1416// by utoppia// http://planetmath.org/PracticalNumber// http://en.wikipedia.org/wiki/Practical_number// http://oeis.org/A005153#include#include#include#inc

2014-04-21 12:12:24 956

原创 一些有意思的网站

找规律的  oeis.org

2014-04-21 10:55:11 618

原创 模板,无向图强连通缩点,tarjan

int first[nMax],nxt[nMax],to[nMax],e;void addadge(int u,int v) { to[e]=v;nxt[e]=first[u];first[u]=e;e++; to[e]=u;nxt[e]=first[v];first[v]=e;e++;}int low[nMax],dfn[nMax],dep,belong[nMax],vis

2014-04-17 16:48:45 2543 1

原创 模板,pollard_rho大数因数分解

大数分解,没有模板你就OUT啦。。。

2014-04-16 21:31:27 1565

原创 模板,树状数组

树状数组的神奇在于省空间和时间;空间复杂度O(

2014-04-16 21:12:18 521

原创 模板,线段树,矩形轮廓周长

原理和面积并是一样的,注意有了两边的长要计算;

2014-04-16 11:17:01 561

原创 模板,线段树,面积并

具体的思路有空补上,先贴代码#include#include#includeusing namespace std;int const nMax = 100000;struct T{ int y[2]; double f[2]; double x; int left; void make(double a,double b,double c,

2014-04-16 10:41:59 540

原创 Ural 1210

最短路神马的最有意思。。。/************************************************************************* > File Name: 1210.cpp > Author: utoppia > Mail: [email protected] > Created Time: 2013/12/20 9:

2013-12-20 09:32:27 722

原创 Ural 1354

做个字符串哈希玩玩。。。/************************************************************************* > File Name: 1354.cpp > Author: utoppia > Mail: [email protected] > Created Time: 2013/12/19 9:4

2013-12-19 10:57:43 677

原创 HDU 1296

表达式求值,蛮有意思的,某年校赛就出这题了呢。。。依然顺手。。。哈哈。。。就算退役了心依然不死呢。。。#include#include#include#includeusing namespace std;int const nMax = 10100;#define sf scanf#define pf printf#define rep(i,n) for(in

2013-12-13 23:02:40 1016

原创 2012 Tianjing Online (HDU4278 - 4287)

4278 Faulty Odometer70.17%(748/1066)4279 Number27.74%(713/2570)    4281 Judges' response56.48%(266/471)4282 A very hard mathematic problem29.56%(107

2013-12-03 16:31:44 632

原创 Ural 1437

I HATE THIS PROBLEM!!! I just write a BF solution  like this:#include#include#include#include#include#include#includeusing namespace std;#define sf scanf#define pf printf#define re

2013-11-27 13:42:15 624

原创 Ural 1371. Cargo Agency

The author is lazy..Code :#include#include#include#include#include#includeusing namespace std;#define sf scanf#define pf printf#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)#def

2013-11-27 11:49:13 701

原创 Ural 1362 Classmates 2

Link To The Pro其实就是简单的树形dp;假设v1,v2,v3..vs是u的儿子,那么将dp[vi]从大到小排序;dp[u] = max(dp[v_i] + i];Code:#include#include#include#include#include#includeusing namespace std;#define

2013-11-27 09:58:00 940

原创 HDU 1027 Ignatius and the Princess II

全排列,next_permutation#include #include #include #include #include #include using namespace std;#define sf scanf#define pf printf#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)#define

2013-11-10 16:03:55 610

原创 HDU 1025 Constructing Roads In JGShining's Kingdom

LIS#include #include #include #include #include using namespace std;#define sf scanf#define pf printf#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)#define dbg(x) cerr << "Line:" << __LI

2013-11-10 15:55:15 505

原创 HDU 1023 Train Problem II

大数 卡特兰数#include #include #include #include #include using namespace std;#define sf scanf#define pf printf#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)#define dbg(x) cerr << "Line:"

2013-11-10 15:01:20 654

原创 HDU 1022 Train Problem I

栈模拟#include #include #include #include #include using namespace std;#define sf scanf#define pf printf#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)#define dbg(x) cerr << "Line:" << __LI

2013-11-10 14:24:07 630

原创 HDU 1011 Starship Troopers

树形dp#include #include #include #include #include using namespace std;#define sf scanf#define pf printf#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)#define dbg(x) cerr << "Line:" << __L

2013-11-10 13:53:54 746

原创 HDU 1007 Quoit Design

最近点对 。#include #include #include #include #include using namespace std;#define sf scanf#define pf printf#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)#define dbg(x) cerr << "__LINE__

2013-11-10 12:56:53 798

原创 ZOJ 3226 Mobile Positioning

Link To The ProblemSolution : Step 1 : 求出B点的坐标(注意时间可能为0)Step 2 : 求出A点的坐标PS:一定要注意所有可能的情况。。。极其猥琐。。。Code : // ZOJ 3226 Mobile Positioning// Geometry & Math Calculate#include

2013-10-24 16:31:56 824

原创 SGU 244. Height, Bisector and Median

Link To The ProblemSolution : 二分、二分a的长度,然后根据l,h计算出角平分线的长度,判断即可。。。Code: // SGU 244 Height Bisector and Median// Solution : Math Calculate//#include#include#include#include#inclu

2013-10-24 00:10:49 920

原创 Amritapuri 2009 (UValive 4676 ) - Geometry Problem

Link To The ProblemSolution : 由于x的范围是10e7,平方的话是10e14,double 的精度可能判不到小的eps。所以在做叉积或者点积做判断的时候注意取方向向量就好。。。否则。。。WA。。。Code :// Amritapuri 2009 Geometry Problem// Solution : 模拟//#include

2013-10-23 01:54:07 976

原创 CERC 1999 (SPOJ 40) Lifting the Stone

Link To The ProblemSolution : 多边形的重心PS : POJ 神数据就是过不掉,SPOJ上1A.。。(尴尬。。。)Code: // CERC 1999 Lifting The Stone// Solution : 多边形的重心//#include #include #include #include #include

2013-10-23 00:00:34 869

原创 SGU 283. Mechanics

Link To The ProblemSolution : 先判断是否碰撞、然后模拟。Code:// SGU 283 Mechanics// Solution : 模拟//#include#include#include#include#include#include#includeusing namespace std;#define F

2013-10-22 23:03:08 648

原创 Ural 1052

#include#include#include#include#include#includeusing namespace std;#define nMax 500#define LL long longtypedef pair point ;#define x first#define y seconddouble const eps = 1e-9;int

2013-10-22 14:08:59 648

原创 SGU 446. Rotation Estimation

Link To The ProblemSolution : 枚举旋转的角度、注意精度,开到1e-6就行了,太大了可能出错Code:// SGU 446 Rotation Estimation// 枚举、凸包、旋转#include#include#include#include#include#include#includeusing names

2013-10-22 13:16:12 731

原创 Beijing 2004 (UVaLive 3137) - Square

Link To The ProblemSolution : 构造、点到线段的最短距离Code:// Beijing 2004 Square// Solution : 构造//#include#include#include#include#include#include#includeusing namespace std;#define

2013-10-22 11:50:31 612

原创 SGU 253. Theodore Roosevelt

Link To The ProblemSolution : 三角剖分、二分、极角排序Code://SGU 253 Theodore Roosevelt//Solution : 三角剖分、二分#include#include#include#include#include#include#includeusing namespace std;#

2013-10-22 11:14:27 760

原创 UVa 11265 The Sultan's Problem

Link To The ProblemSolution : 半平面交、多边形面积Code:// UVa 11265 The Sultan's Problem// HalfPlane Intersection//#include#include#include#include#include#include#include#includeus

2013-10-22 10:33:40 704

原创 SGU 227. The art to the broad masses!

Link To The ProblemSolution : 圆交、点在弧上的判断PS: SGU 的数据真真有点恶心,一开始完全没有意识到还有重合的情况啊。。Code:// SGU 227 The art to thr broad masses// Solution :圆交、点在弧上的判断、// 两弧相交的结果是,一个点、两个点、一段弧、没有//#in

2013-10-22 09:54:39 673

原创 UVa 10794 The Deadly Olympic Returns!!!

Link To The ProblemSolution : 数学,计算Code://UVa 10794// | a-b |^2 = |a|^2 + |b|^2 + 2*(a*b) #include#include#include#include#include#includeusing namespace std;#define dbg(x)

2013-10-22 08:39:35 758

原创 Ural 1046 Geometrical Dreams

Link To The ProblemSokution : 用复数类可以使问题大大简化Code:#include#include#include#include#include#include#include#include#includeusing namespace std;#define nMax 300#define LL long

2013-10-22 01:18:41 854

原创 Shanghai 2004(UVaLive 3263) - That Nice Euler Circuit

Link To The ProblemSolution : 离散化,欧拉平面公式: V - E + F = 2// Shanghai 2004 That Nice Euler Circuit// Solution : #include#include#include#include#include#include#includeusing namespac

2013-10-22 01:09:37 806

原创 WF 2008 (UVaLive4127 ) - The Sky is the Limit

Link To The ProblemSolution : 离散,模拟Code :// WF 2007 The Sky is the limit// Solution : 离散#include#include#include#include#include#include#includeusing namespace std;#defin

2013-10-21 23:59:22 779

原创 Uva 10792 The Laurel-Hardy Story

Link To The ProblemSolution : Math Code:// UVa 10792 The Laurel Hardy Story// Math#include#include#include#include#include#include#includeusing namespace std;#define FOR(i

2013-10-21 19:30:59 708

空空如也

空空如也

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

TA关注的人

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