Time of Update: 2018-12-03
the first problem is 112.It's a complicated problem but not hard.We can deal with the input firstly,put all the valid character into a string and we can use a var "pair" substitute the
Time of Update: 2018-12-03
3.【最大連續和】sum【題目描述】輸入一個長度為n的整數序列(A1,A2,……,An),從中找出一段連續的長度不超過M的子序列,使得這個序列的和最大【輸入格式】第一行兩個數n,m接下來n行,每行一個數ai。【輸出格式】一行,最大的滿足條件的連續的長度不超過M的子序列。【資料範圍】30%的資料:n<=3000,m<=100100%的資料N,M<=1000000,-maxlongint<=ai<=maxlongint【範例輸入】4 2-1 3 –10 20【範例輸出】
Time of Update: 2018-12-03
先講839,這是binary tree裡面的題,是判斷樹的節點重量是否平衡,解題接的我快無語了,先是看錯提, 後來又做錯,再後來是re,最後,明白了,遍曆可以跟建樹結合,這樣就不會棧溢出,因為如果你先建樹(遞迴),再遍曆又遞迴是很容易溢出的,反正遞迴棧總有要返回的,所以乾脆一邊建樹,一邊解答,具體的看代碼://#define
Time of Update: 2018-12-03
4.【最小函數值】minval 【題目描述】 有n個函數,分別為F1,F2,...,Fn。定義Fi(x)=Ai*x^2+Bi*x+Ci(x∈N*)。給定這些Ai、Bi和Ci,請求出所有函數的所有函數值中最小的m個(如有重複的要輸出多個)。【輸入格式】 第一行輸入兩個正整數n和m。 以下n行每行三個正整數,其中第i行的三個數分別為Ai、Bi和Ci。輸入資料保證Ai<=10,Bi<=100,Ci<=10 000。【輸出格式】
Time of Update: 2018-12-03
sudo apt-get update升級軟體源列表 sudo apt-cache search opencv列出所有跟opencv有關的lib資訊those would be list :harpia -Image Processing/Computer Vision Automatic Prgm. Toollibcv-dev -development files for libcvlibcv4 - computer vision librarylibcvaux-dev -
Time of Update: 2018-12-03
題目類型:棧題目描述:括弧匹配經曆:杯具,WA了數次,原因:Yes,No我寫成YES,NO。。。。。。心得:1要小心輸出。。。。 2變數最好初始化代碼:#include<stdio.h>#include<string.h>char s[150];int top=0;int pop(char &x){ if(top==0)return 0; x=s[--top]; return 1;}int push(char
Time of Update: 2018-12-03
Problem 1 heart.pas/c/cpp(heart.in heart.out) 【背景】
Time of Update: 2018-12-03
10004 深度搜尋,將邊兩邊的點賦值為不同顏色(bool類型),因為是強聯通圖,所以只需一次就夠,判斷是否存在有向環以及該有向環是否是否滿足點顏色相同,#include<cstdio>#include<cstdlib>#include<string>#include<cmath>using namespace std;const int maxn=205;int
Time of Update: 2018-12-03
在使用QT3 windows下版本時,試圖用mingw32編譯,但是總是遇到一下錯誤:kernel/qinputcontext_win.cpp: In static member function 'static bool QInputContext::endComposition(QWidget*)':kernel/qinputcontext_win.cpp:462:43: error: 'qt_sendSpontaneousEvent' was not declared in this
Time of Update: 2018-12-03
題目類型:判斷無聊的水題。。。1AC唯一迷惑的地方:譬如94有輸出,儘管題目說9S4,但S可以是空的,大概除此之外,真的沒有其他的代碼:#include<stdio.h>#include<string.h>int main(){ char s[1000]; int n; scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%s",s); int
Time of Update: 2018-12-03
1: mkdir /rhel_dvdmount -o loop /mydoc/rhel-5-server-i386-DVD.iso /rhel_dvd2:rpm -ivh /rhel_dvd/Server/createrepo-0.4.4-2.fc6.noarch.rpm3:gedit /etc/yum.repos.d/rhel_local.repo新增內容如下:[Cluster]name=Red Hat Enterprise Linux
Time of Update: 2018-12-03
題目類型:線性排序解題過程:這道題思路是參考knowledgetime的,後來自己用數學歸納法證明了一下演算法正確性,杯具的是太久沒做題,竟然又忘了scanf與輸入字串時要加getchar();好噁心,弄了好久。。。題目:給出一序列字串,再給出目標序列,要求,每次只能將源序列中的字串置頂,輸出:最少操作時應該置頂的字串解題:等同於:這題就是發現規律,通過棧區去實現。第前n個輸入時不做任何處理。後n個輸入要尋找對應前n個的相應位置。然後從底往上找到第一個比下層大的,然後從這個一直相應輸出前n個名字
Time of Update: 2018-12-03
qt-embedded-linux-opensource-src-4.5.1移植到QQ2440開發板 http://www.cnblogs.com/cnnbboy/archive/2009/06/06/1497780.html前言:非常漫長的過程,可以說,移植qte4.5.1是我移植qte以來最難的一次,前面幾次都非常順利的完成了,這次卻花了很大的力氣,期間得到了阿樂的大力協助,可以說移植完成,是我們兩個人的汗血啊。摘要:在友善之臂QQ2440
Time of Update: 2018-12-03
問題描述:給出n個二元組(Oi,Ti),看看能否一一對應,即(Oi,Ti)---(Ti,Oi),能yes,否no舉例:31 22 11 2no41 22 11 22
Time of Update: 2018-12-03
題目類型:數學,數論心得:找規律,打表代碼:#include#include#includeint main(){ long n,row,column;while(scanf("%d",&n)==1){row=column=0;if(n==0)break;long k=0;k=(long)(sqrt(n)+0.5);if(k*k>n)k=k-1;if(k*k==n){if(k%2){row=1;column=k;}else
Time of Update: 2018-12-03
題目類型:數學解題思路:類比就行了解題心得:理解好題意代碼:#include<stdio.h>#include<math.h>#define eps 1e-9int main(){int H,U,D,F;while(scanf("%d%d%d%d",&H,&U,&D,&F)==4){if(!H ) return 0;double climb=U,slide=D,cur=0,s;int
Time of Update: 2018-12-03
問題描述:計算一次加法的代價為兩個加數的和,求計算一條加法公式的總代價類型:哈弗曼演算法解法:用兩個隊列類比哈弗曼即可,或者優先隊列?#include<cstdio>#include<cstdlib>#include<string>#include<algorithm>using namespace std;const int MAXSIZE=500001; long long P[MAXSIZE],Q[MAXSIZE]; int
Time of Update: 2018-12-03
#include<stdio.h>#include<math.h>#include<string.h>#define eps 1e-9typedef struct TNode{char data;struct TNode *left,*right;}Node;Node nodes[10000];Node *root;char key[1000+10];int tk=0;void SecondOptimal(Node * &T,char
Time of Update: 2018-12-03
題目類型:數學解題過程:題目很簡單,但噁心的精度問題,沒考慮,最終延續杯具曆史。。。千萬不能用整形輸出原因:題目的N可能為2^31-1,所以。。。。解題心得:要注意範圍,還有邊界 最後:#include<stdio.h>#include<math.h>#define eps 1e-9int main(){int n;while (scanf("%d",&n)==1){if(n<0) return 0;if(n==1 || n==0 ){printf("0%%
Time of Update: 2018-12-03
At the first look, this problem seems to be tricky to solve. However, if you implement all the specifications precisely, it would be already solved. There's no need to "translate" the problem's specifications.Code:/***********************************