強烈推薦網址:http://www.notonlysuccess.com/?p=931 hdu 1693 Eat the Trees多迴路的不用判聯通狀態,二進位即可,轉移情況2*2種。 時間O(n*m*2^n) 空間O(n*2^n)/**插頭DP**/#include <cstdio>#include <cstring>const int maxm=13 ;const int maxn=1<<12;typedef long long ll ;ll dp[
文章目錄 Input SpecificationOutput SpecificationSample InputSample Output ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE3s8192K12855StandardFlavius Josephus and 40 fellow rebels were trapped by the Romans. His companions
類似排隊打水問題;定義每個怪物的性價比bi=怪物的攻擊力/v11對怪物的擊打次數。對bi進行一次sort 從大到小,一次加和即可。可以證明先消滅性價比小的 後消滅大的 會使損失值增大,對性價比相同的怎麼處理都不影響結果。代碼:要用longlong 。 #include <cstdio>#include <algorithm>using namespace std;const int maxn=10010;typedef long long typec;struct
ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE1s8192K39554StandardGiven a nonnegative integer a, and a positive integer N, we define: f(a, 1) = af(a, k) = f(a, k – 1) * f(a, k – 1) % N, k > 1There may or may not exist some positive integer k
HDU 最大子矩陣 1559 利用容斥原理求出(0,0)到(i,j)的矩陣裡的值的和,類似一維的首碼和。#include <cstdio>#include <cstring>const int maxn=1001;int dp[maxn][maxn];int main (){ int cas; int n,m,x,y; scanf("%d",&cas); for (int I=1 ; I<=cas ; ++I) {
ResultTIME LimitMEMORY LimitRun TimesAC TimesJUDGE5s8192K26242StandardArctan function can expand to an infinite progression: People often caculate pi using arctan functions.For example,the easiest way to calculate π is : however,it's too inefficient,