原创 CERC 1999 (SPOJ 40) Lifting the Stone

Link To The Problem Solution : 多邊形的重心 PS : POJ 神數據就是過不掉,SPOJ上1A.。。(尷尬。。。) Code:  // CERC 1999 Lifting The Stone // S

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

Link To The Problem Solution : 圓交、點在弧上的判斷 PS: SGU 的數據真真有點噁心,一開始完全沒有意識到還有重合的情況啊。。 Code: // SGU 227 The art to thr bro

原创 HDU 1023 Train Problem II

大數 卡特蘭數 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <math.h> using namesp

原创 模板,線段樹,面積並

具體的思路有空補上,先貼代碼 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; int const nMax = 100000; s

原创 模板,線段樹,矩形輪廓周長

// poj 1177 矩形輪廓周長 // by utoppia #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> using names

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

大數分解,沒有模板你就OUT啦。。。 #include<iostream> #include<algorithm> #include<cstdio> #include<cstring> using namespace std; type

原创 模板,擴展,離散對數,數論

擴展版的離散對數 基本思路還是基於 Shank的大小步算法(Shank's Baby-Step-Giant-Step Algorithm) // hdu 2815 // by utoppia #include<cstdio> #incl

原创 HDU 1817 , POJ 1286

polya // hdu 1817 poj 1286 // by utoppia // polya #include<cstdio> typedef long long ll; ll pow(ll a,int n) { ll

原创 模板,FFT 快速傅里葉變化

大神的模板。。偷過來用着先 /* algorithm : High-Precision FFT */ #include <cstdio> #include <cstring> #include <cmath> #include <a

原创 模板,凸包

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(cro

原创 模板,樹狀數組

樹狀數組的神奇在於省空間和時間; 空間複雜度O(n),時間複雜度O(nlogn); 這樣的複雜度比線段樹有一定的優越性; 主要的組成就是三部分int inline lowbit(int x) { return x & (-x); } v

原创 HDU 1027 Ignatius and the Princess II

全排列,next_permutation #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <math.h>

原创 CSU 1416 Practical Number 很有意思的數學題

基本上就是一個結論題,然後wiki一下就出了 // csu 1416 // by utoppia // http://planetmath.org/PracticalNumber // http://en.wikipedia.org/w

原创 模板,無向圖強連通縮點,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]

原创 Ural 1354

做個字符串哈希玩玩。。。 /************************************************************************* > File Name: 1354.cpp >