HDU 1541 Stars (樹狀數組),hdu1541Problem DescriptionAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and
poj1351Number of Locks(記憶化搜尋),poj1351numberlocks題目連結:傳送門思路:這道題是維基百科上面的記憶化搜尋的例題。。。四維狀態dp[maxn][5][2][5]分別表示第幾根棒子,這根棒子的高度,是否達到題目的要求和使用不同棒子數,那麼接下來就是狀態轉移了。。。要用到位元運算判斷以前是否這種高度的棒子用到沒。。。那麼這個問題就解決了。。。題目:Number of LocksTime Limit: 1000MS Memory
HDU 4969 Just a Joke(積分),hdu4969HDU 4969 Just a Joke題目連結推公式,r′=dr/dt=vy=v22−v12r2/R2−−−−−−−−−−−−√,可得積分公式為∫R0y=1/v22−v12x2/R2−−−−−−−−−−−−−√,利用三角換元去化簡即可代碼:#include <cstdio>#include <cstring>#include <cmath>typedef long long ll;int
HDU 4965 Fast Matrix Calculation(矩陣快速冪),hdu4965HDU 4965 Fast Matrix Calculation題目連結矩陣相乘為AxBxAxB...乘nn次,可以變成Ax(BxAxBxA...)xB,中間乘nn - 1次,這樣中間的矩陣一個只有6x6,就可以用矩陣快速冪搞了代碼:#include <cstdio>#include <cstring>const int N = 1005;const int M =
SPOJ 1043 Can you answer these queries I 求任意區間最大連續子段和 線段樹,spojqueries題目連結:點擊開啟連結維護區間左起連續的最大和,右起連續的和。。#include <cstdio>#include <iostream>#include <algorithm>#include <string.h>#include <math.h>#include
【源碼】LinkedHashMap源碼剖析,linkedhashmap源碼註:以下源碼基於jdk1.7.0_11之前的兩篇文章通過源碼分析了兩種常見的Map集合,HashMap和Hashtable。本文將繼續介紹另一種Map集合——LinkedHashMap。顧名思義,LinkedHashMap除了是一個HashMap之外,還帶有LinkedList的特點,也就是說能夠保持遍曆的順序和插入的順序一致,那麼它是怎麼做到的呢?下面我們開始分析。首先看構造器。public class