Time of Update: 2018-12-05
在關閉ARC情況下對NSMutableArray儲存記憶體分析。一:測試環境構建1:建立一個簡單視窗工程 在AppDelegate.m- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen]
Time of Update: 2018-12-05
寒假大概用了進2周的時間決定,放棄ACM來考研,一個人的精力終究有限,我還是更渴望研究生給我的平台,繼續對演算法的研究。大概發生了很多事,都讓我無法平靜。在家做足了準備,回學校就投入了很多時間來準備考研,精力還算放的下,但是遠遠不夠,而且現在時常走神,還不是因為那個讓我糾結的妹紙。 大概我最大的進步就是發現了自己急功近利的毛病,並且一點點的改正了,雖然做的不夠,但是我還是很努力的改正。今年的賽事又很多,老師還拉著讓我這個隊參加,不能不去了,隊友也老是鼓勵和諷刺,反正各種方法都用上了,在騰出來點時
Time of Update: 2018-12-05
1.2.6 find your present(2)hdu 2095用位元運算 ^ => 1^3^7^3^1 = 7#include<iostream>using namespace std;int main(){ int n,s,a; while(scanf("%d",&n)&&n) { s = 0; while(n--) { cin>>a;
Time of Update: 2018-12-05
PROB Milking Cows [ANALYSIS] 對於區間的問題的求法//最長連續區間。/* 考慮:區間兩端點相等的情況。 * 區間如何排序 * 每次區間要求的值改變的情況都去吃max *每次都要考慮區間最初和最後 */struct cmp{bool operator () (PII a,PII b) {if(a.first == b.first) return a.second > b.second;// 遞增return a.first > b.first;}};int
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
解題報告: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
by MDK!2011/11/14 21:34Crafting Winning Solutions A good way to get a competitive edge is to write down a game plan for what you're going to do in a contest round. This will help you script out your actions, in terms of what to do both when things
Time of Update: 2018-12-05
PROB Preface Numbering [ANALYSIS] ---- 又是枚舉,讓我不得不相信枚舉的實力了。應該是估算資料量的作用,1000的數量級,不過才怪,我還想著去按位DP。。。。 int n;int sum_ge[7];//idx 1 - 3void calculate(int x,int idx){switch(x) {case 0:break;case 1:sum_ge[2*(idx-1)]++;break;case
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
看下面一段程式#include <stdio.h>int main(){double i;for(i = 0; i != 10; i += 0.1) printf("%.1lf\n", i);}你也許覺得這個程式很容易理解;但是請別相信自己的想象力,運行一下:什麼無限輸出下去??不是按到底到10的時候會停止嗎?再看一段程式:#include <cstdio>#define exp 0.000001int main(){if(0.1+0.1+0.1 == 0.3)
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
/* 學習李大牛每天複習之前寫過的演算法,每天找一題出來做做複習; *****並查集篇*******/這還算是一道簡單的並查集,思路在代碼中:15MS340K#include <iostream>#include <algorithm>#include <cstring>#include <string>#include <cmath>#include <cstdio>#include
Time of Update: 2018-12-05
1. 想學的技術非常多,該怎麼辦?區分重點,選定目標,循序漸進。技術是無邊際的,隨著知識的不斷增加,會發現未知的東西更多。我們能做的是:1) 找重點:區分感興趣的技能和必須技能,將重點放在必須技能上。如實在區分不開,可以這樣問自己:不學這個技術會現在的工作是不是幹不下去了?2) 定目標:在一段時間(至少半年內)選定一個技術方向,精研下去。3) 不斷向前:當某一種技術掌握後,再開始另一個技術的研究; 2.
Time of Update: 2018-12-05
/* 說到底,還是並查集; 當然這題比較特殊;*/一般的並查集應該這麼寫:for(int i = 1; i <= m; i++) //########{scanf("%d%d",&x,&y);Union(x,y); //合并} //########一般並查集合并的是 兩個有關係的;題目輸入的是x y 如果x y
Time of Update: 2018-12-05
BFS:起點入隊;開始搜尋:讀取隊首並出隊,搜尋範圍有四周八個點(有的不存在),搜尋到的點入隊,並將歩長+1;直到讀取的點等於終點;15MS372Kcode:#include <iostream>#include <string>#include <cstdio>#include <queue>using namespace std;struct point{int x;int y;int step;}st,ed;int
Time of Update: 2018-12-05
轉載自C/C++程式員之家本文原始連結地址: STL中優先隊列的使用隊列的特點是先進先出。通常都把隊列比喻成排隊買東西,大家都很守秩序,先排隊的人就先買東西。但是優先隊列有所不同,它不遵循先進先出的規則,而是根據隊列中元素的優先權,優先權最大的先被取出。通常把優先隊列比喻成現實生活中的列印。一個列印店裡有很多印表機,每台機器的效能不一樣,有的印表機列印很快,有的印表機列印速度很慢。當這些印表機陸陸續續列印完自己的任務時進入排隊等候狀態。如果我這個時候要列印一份檔案,我選的不是第一個排隊的印表機