Time of Update: 2018-12-05
/*母函數題;只是限定了一些範圍,加上就可以了;http://acm.hdu.edu.cn/showproblem.php?pid=2152*/#include <iostream>using namespace std;#define maxn 105int a[maxn],b[maxn],minum[maxn],maxnum[maxn];int main(){int n,m;while(cin>>n>>m){for(int i = 0; i < n;
Time of Update: 2018-12-05
/*http://acm.hdu.edu.cn/showproblem.php?pid=2079簡單的母函數題目;開始把題目看錯,以為個相同學分的不同科目是算不同的;後來發現是相同的;如果是不同的,那結果很大;當然這是我審題錯誤;*/#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <
Time of Update: 2018-12-05
POJ 2823#define MAXN 1000003int a[MAXN];int n,m;struct node {int num,t;}q[MAXN];int head,rear;void add(int num,int i) {while(head <= rear && q[rear].num <= num) rear--; rear++; q[rear].num = num; q[rear].t = i;}void addmin(int
Time of Update: 2018-12-05
PROB Packing Rectangles [ANALYSIS]----第一題是3天前看到的,事隔一課考試,全校答辯,今天終於A出來了,每天都在想,都在想,終於對這個題目比較明白了。/*solution 11枚舉排列數2枚舉翻轉3按6種情況枚舉最小的4所有情況記錄所有最小值*/int rectx[4],recty[4];int meijux[4],meijuy[4];bool vis[4];int sumx,sumy,sumarea = INT_MAX;map<PII,int>
Time of Update: 2018-12-05
解題報告:http://blog.renren.com/share/263436810/8196564875 (+
Time of Update: 2018-12-05
http://codeforces.com/contest/278/problem/B/* *題目:字串數目n 1≤n≤30,每個字串的長度不超過20 *含有兩個字元的字串有676種,大於600, *所以不是它的子串的字串在兩位中就產生了 *多謝大牛指點。。。 */#include <iostream>#include <cstdio>#include <string>#include <cstring>using namespace std;
Time of Update: 2018-12-05
translate by MDK –11.11.21 9:23Binary Numbers Representing Binary NumbersComputers operate on 1's and 0's; these are called 'bits'. A byte is a group of 8 bits, like this: 00110101. A computer word on my computer ('int') is 4 bytes, 32 bits: 10011
Time of Update: 2018-12-05
/*初學母函數,練練手;*/母函數解:/*求整數n的整數拆分方法;題目理解為:將數字1、2、3、……n;每個數字可以選取無限次,求能組成n的情況總數函數 (1+x+x^2+x^3……)(1+x^2+x^4……)(1+x^3+x^6+x^9……) ……第一項的意義是:取0個1,取1個1、2個1,3個1……第二項的意義是:取0個2,取1個2……以此類推 ;每個括弧為一個大項,我們先將第一大項和第二大項乘起來,得到結果和第三項相乘……以此類推; */#include
Time of Update: 2018-12-05
/*無聊水了一題只怪自己太水,水題也花了好久時間;*/#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <string>#include <iomanip>using namespace std;int change(char
Time of Update: 2018-12-05
PROB Number Triangles [ANALYSIS] ----- 簡單DP//solution 1DPint dp[MAXN][MAXN],n;int a[MAXN][MAXN];int main(){FOPENTIFOPENTOSET(dp,0);SCF(n);F(i,n) F(j,i+1){SCF(a[i][j]);}for(int k = 0;k<n;k++){dp[n-1][k] = a[n-1][k];}for(int i =
Time of Update: 2018-12-05
/*再水一題sort()應用+strcmp()應用;*/http://acm.hdu.edu.cn/showproblem.php?pid=1236點擊開啟連結#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <string>#include
Time of Update: 2018-12-05
/* 先初始化,再一個一個來;注意i,j,k範圍的變化;參考大牛資料母函數(Generating function)詳解 — TankyWoo*/#include <iostream>using namespace std;int a[10005],b[10005];int main(){int num1,num2,num3;while(cin>>num1>>num2>>num3){if(num1==0&&num2==0&&
Time of Update: 2018-12-05
/*一直沒複習;感覺以前學的忘光了*/#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <string>#include <iomanip>#define maxn 3500int cost[maxn],worth[maxn];int dp[12885];using
Time of Update: 2018-12-05
PROB Mixing Milk [ANALYSIS] ---- 最常見的一種貪心了吧,沒啥好說的。analysis 裡面://很是犀利的想法for(i=0;i<M;i++) { fscanf(in, "%d %d", &(price), &(amount)); amount_for_price[price]+=amount;}PROB Barn Repair [ANALYSIS] ----
Time of Update: 2018-12-05
/* 有關這個問題畫了太多時間了; 對自己真的很失望,思維能力太差了; 慶幸的是自己堅持看懂了; 希望下次碰到能夠靈活運用;*/題目其實可以轉換成背包問題;由於資料是-100000~100000;所以我們取數組 dp[100000*2];我們產生一個相對座標的概念,100000相對座標為0;99995相對座標為-5;x的相對座標為x-100000;由於每組資料的屬性都為價值;而對於背包的容量是無限擴充的,(題目要求的就是
Time of Update: 2018-12-05
/*可以用母函數解決;前幾天練熟了,再試試手;*/http://acm.hdu.edu.cn/showproblem.php?pid=2082#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <cmath>#include <string>#include <iomanip>#define
Time of Update: 2018-12-05
譯文 by MDK on 2011.11.16 8:28Search Techniques 搜尋技術Sample Problem: n Queens [Traditional]Place n queens on an n x n chess board so that no queen is attacked by another queen. 例子:n 皇后問題把n個皇后放在 n * n 的棋盤裡面,是得每對皇后不會互相攻擊.Depth First Search (DFS) The
Time of Update: 2018-12-05
少最佳化->多最佳化: O0 -->> O1 -->> O2 -->> O3 -O0表示沒有最佳化,-O1為預設值,-O3最佳化層級最高 英文解析: `-O ' `-O1 ' Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function. With `-O ', the
Time of Update: 2018-12-05
最初寫法:dp[0][0] = s1[0]==s2[0]?1:0;for(int j = 1; j < len2; j++){ if(s1[0]==s2[j]) dp[0][j] = 1; else dp[0][j] = max(dp[0][j],dp[0][j-1]); } for(int i = 1; i < len1; i++) { if(s1[i]==s2[0]) dp[i][0] = 1; else dp[i][0]
Time of Update: 2018-12-05
立項終於完事,累屎人了,11.18好下午全校答辯,做得還行吧,到這發現沒話說了。。。 兩個項目:車牌識別,藍芽個域網,湊合著通過了,400元項目資金,真寒酸,不知道等到什麼時候錢才能給!USACO因此耽擱了三天(答辯前一天考試,周四,周五,周六三天。。。我在計算什嗎?)。 上午在找ocean這個電影,發現基地的網速根本緩衝不了。無奈這個馬上就要拆的樓房,不知道下學期去那,真希望學校能夠在給分一個地方,學校什麼時候能多重視科研,少點學生管理?!