原创 LeetCode 5.最長迴文子串[區間DP]

題目:給定一個字符串 s,找到 s 中最長的迴文子串。你可以假設 s 的最大長度爲 1000。 示例 1: 輸入: "babad" 輸出: "bab" 注意: "aba" 也是一個有效答案。 示例 2: 輸入: "cbbd" 輸

原创 ZOJ3203 Light Bulb[三分/推公式]

Light Bulb Time Limit:1000MS     Memory Limit:32768KB Submit Status Description Compared to wildleopard's

原创 LightOJ1028 1090 1138 Trailing Zeroes (I)(Ⅱ)(Ⅲ)[算數基本定理/打表/打表+二分]

C -  Trailing Zeroes (I) Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status

原创 HDU5768 Lucky7[中國剩餘定理+容斥定理]

E - Lucky7 Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Descripti

原创 HDU5301 Buildings [圖形]

B - Buildings Time Limit:2000MS     Memory Limit:131072KB     64bit IO Format:%I64d & %I64u Submit Status Practice 

原创 HDU5456 Matches Puzzle Game[數位DP]

E - Matches Puzzle Game  HDU - 5456  題意: 給T組數據,每組數組給一個n和m。n代表有n根小棍,問用這些小棍去組成一個A-B=C的等式有多少種方法,結果取模m。 題解: 先把題

原创 HDU3709 Balanced Number[數位DP]

C - Balanced Number  HDU - 3709  題意: 給T組數據,每組數據給出一個x和y,求出[x,y]當中滿足以其中一位爲平衡點,滿足在平衡點的左右兩邊的力矩大小一致。 題解: 這道題要注意前

原创 HDU1796 How many integers can you find[容斥定理]

D - How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Sub

原创 POJ1064 Cable master[二分]

Time limit 1000 ms Memory limit 10000 kB OS Linux Source Northeastern Europe 2001 Cable master  POJ - 1064 

原创 HDU1166 敵兵佈陣[線段樹/樹狀數組]

X - 敵兵佈陣 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Description

原创 HDU3555 Bomb[數位DP]

B - Bomb  HDU - 3555  題意: 給T組數據,每組數組給出一個n,問在[0,n],存在多少個數含有49(49是要連着的,至少含有一個就可以了)。 題解: 只要記錄下三個狀態,0號狀態代表前面沒

原创 UVALive6886 Golf Bot[FFT]

M - Golf Bot  UVALive - 6886  Do you like golf? I hate it. I hate golf so much that I decided tobuild the ultimate

原创 HDU5446 Unknown Treasure[中國剩餘定理+Lucas]

Unknown Treasure  HDU - 5446   題意: T組數據, 給你n,m,k ,接下來給你k個素數 求C(n,m)%(這k個素數的積) 題解: 題目給我的M 是由(p1*p2*...

原创 HDU4407 Sum[容斥定理]

D - Sum Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 44

原创 HDU4734 F(x)[數位DP]

D - F(x) HDU - 4734 題意:求出存在[0,B]中x使得F(x)小於等於F(A)的數有多少個。題解:首先求出F(A)的值,用這個值作爲標記的初始值,第一維代表當前位置,第二維代表剩餘值。而第二維的取值,最多能達到9*9*2