Time of Update: 2018-12-03
#include <iostream>#include <algorithm>using namespace std;int grades[6];int main(){ int i, sum; double avg; while (cin >> grades[0] >> grades[1] >> grades[2] >> grades[3] >> grades[4] >>
Time of Update: 2018-12-03
1.初始化線性表L,即進行動態儲存裝置空間分配共置L為一個空表2.清除線性表L中的所有元素,釋放儲存空間,使之成為一個空表3.返回線性表L當前的長度,若L為空白則返回0 4.判斷線性表L是否為空白,若為空白則返回1, 否則返回0 5.返回線性表L中第pos個元素的值,若pos超出範圍,則停止程式運行6.順序掃描(即遍曆)輸出線性表L中的每個元素 7.從線性表L中尋找值與x相等的元素,若尋找成功則返回其位置,否則返回-18.把線性表L中第pos個元素的值修改為x的值,若修改成功返回1,否則返回09
Time of Update: 2018-12-03
//這題總的來說是水題,只要認真的理解到題目的意思就很容易了! #include <iostream>#include <string>#include <algorithm>using namespace std;int main(){ int i, j, len1, len2; string keyword, ciphertext, ans, tmp1, tmp2, order, div[100]; while (cin >>
Time of Update: 2018-12-03
幾乎當今所有的應用程式開發架構都是以事件為驅動的,Qt也不例外,Qt作為一個跨平檯面向對象的應用程式開發架構,對不同作業系統的底層事件響應機制進行了統一的封裝,並建立了提套完備的事件機制,形成了別具特色的Qt事件系統。Qt事件機制Qt作為一個事件驅動的工具集,其事件和事件派發起到了核心作用。在Qt的事件機制中,Qt將環境變化的資訊組織成一個繼承自QEvent的對象,並通過調用QObject::event()將之發送到繼承自QObject的目標對象事件處理隊列中,交由目標對象相應。Qt事件的大致流
Time of Update: 2018-12-03
#include <iostream>#include <string>#include <map>#include <algorithm>using namespace std; struct Info{ int rule; string str1, str2; map<string, string>
Time of Update: 2018-12-03
題目:二叉樹的結點定義如下:struct TreeNode{ int m_nvalue; TreeNode* m_pLeft; TreeNode* m_pRight;};輸入二叉樹中的兩個結點,輸出這兩個結點在數中最低的共同父結點。我的思路就是,普通的遞迴方式遍曆二叉樹,但是當遇到一個節點值相同時,如果為左子樹則遍曆右子樹(當然此時另外一個函數處理),反之亦然。網上看到的思路 相當不錯採用後序遍曆,先判斷左子樹是否包含一個節點,然後判斷右子樹是否包含,最後判斷當前節點是否包含。
Time of Update: 2018-12-03
//注意重複的或者其soundx值相等的字元應該先去掉! #include <iostream>#include <string>#include <map>using namespace std;map<char, int> m;int main(){ m['B'] = 1, m['F'] = 1, m['P'] = 1, m['V'] = 1; m['C'] = 2, m['G'] = 2, m['J'] = 2, m['K'] =
Time of Update: 2018-12-03
//沒有認真讀題,WA了兩次,因為他們的差值的順序不一定需要按升序或者降序排列的!具體可以用下面的資料進行測試! #include<iostream>#include<cstring>#include<cmath>using namespace std;int dif[3000];int main(){int n;while(cin >> n){memset(dif,0,sizeof(dif));int pre,current;cin
Time of Update: 2018-12-03
//這題我以為是和3670是一模一樣的題目,就直接將3670的代碼複製過來,點知WA了一次,然後再看看題目//原來這一題只是求最長遞增子序列就OK了,呵呵,抵死的WA,誰叫不讀題! #include <iostream>#include <cstdio> #include <memory.h> #include <climits> #include <algorithm> using namespace std; const int
Time of Update: 2018-12-03
//求進位的次數:注意兩個加數的位元有可能不相等! #include <iostream>#include <string>#include <algorithm> using namespace std;int main(){ string str1, str2; int len1, len2, len, i, ans, tmp; while (cin >> str1 >> str2){ if (
Time of Update: 2018-12-03
半年後又重新編譯Qt的開發環境,還是不太順利,所以這次寫個總結關於編譯X11版本的環境,沒有參數需要配置 (1)./configure 出現"make: g++:命令未找到"錯誤,解決辦法:apt-get install g++ 再次運行./configure,出現"Basic XLib functionality test failed! You might need to modify the include and library search paths by
Time of Update: 2018-12-03
//雖然是水題一題,但是陷阱多多,要多加小心!//1.輸入的兩個字串中可能存在著空格!//2.當輸入有空行的時候,輸出的答案是空行! #include <iostream>#include <string>#include <algorithm>using namespace std;int main(){ int i, j, lena, lenb; string a, b, ans; while (getline(cin, a),
Time of Update: 2018-12-03
//對c語言中的輸入和輸出熟悉的情況之下就很快可以解決問題了! #include <iostream>#include <string>#include <cstdio>using namespace std;int main(){ int tc, year, day, month, hour, min, sec; scanf("%d", &tc); while (tc--){
Time of Update: 2018-12-03
//這題如果理解了KMP演算法中next數組的具體代表什麼和求解過程,問題就不大了! #include <iostream>#include <string>#include <memory.h>using namespace std;int next[1000010];//next數組的求解! void get_next(string str, int *next, int len){ int i, j; next[0] = -1;
Time of Update: 2018-12-03
//和蛇形填數是同一種類型的題目,要進行預判斷! #include <iostream>using namespace std;char map[10000][10000];int main(){ int i, j, m, n, tot; char ch = 'A'; cin >> m >> n; for(i = 0; i < m; i++) for (j = 0; j < n; j++)
Time of Update: 2018-12-03
#include <iostream>#include <memory.h>using namespace std;const int MAX = 1000;int dp[MAX][MAX];int main(){ char str1[MAX], str2[MAX], LCS[MAX]; int i, j, len1, len2; while (1){ cin.getline(str1, MAX);
Time of Update: 2018-12-03
//需要考慮的情況比較多,要一步一步地進行類比,要小心其值是取哪一個字串的長度! #include <iostream>#include <string>#include <vector>#include <algorithm> using namespace std;vector<string> v;void is_replace(string str1, string str2) { int i, len, c = 0;
Time of Update: 2018-12-03
#include <iostream>#include <cstdio>#include <cstdlib> using namespace std;typedef int ElemType;typedef struct LNode{ ElemType data; struct LNode *next;}LinkList;LinkList *p, *q, *L;//鏈表的初始化,建立一個帶頭結點的鏈表void
Time of Update: 2018-12-03
//這題需要考慮的情況也比較多,有點煩,一定需要用清晰的思路,要不很容易出錯,尤其是對四種情況的討論! //這題WA了兩次,一次是:輸出的英文寫錯了,是自己手打的,沒有進行對範例的複製粘貼,下次要謹記!//第二次是沒有講‘O’和‘0’考慮進去,粗心了! #include <iostream>#include <string> using namespace std;int main(){ int i, j, len; string str, tmp;
Time of Update: 2018-12-03
//這題足足用了我4個多小時來檢查錯誤(半個小時寫代碼)!實在太愚蠢了!頭都爆了!哎!//而且這一題並沒有區分大小寫,一般沒有考慮到的情況,都可以通過代碼後面的範例發現,//這題實在太坑爹了!被折磨了數小時,經曆了無限次WA!雖然是水題一道! #include <iostream>#include <string>#include <map>using namespace std;map<string, int> m;map<string,