原创 2018-07-24 二分三分練習題

A  -- Can you find it? Description Give you three sequences of numbers A, B, C, then we give you a number X. Now you

原创 2018-07-23 STL練習題題解

A  -- Game Rank Description The gaming company Sandstorm is developing an online two player game. You have been asked

原创 先根遍歷__非遞歸操作

// 先序(附帶葉子標記)建樹 #include<iostream> #include<stdio.h> #include<stdlib.h> #include<string.h> #include<stack> #include<str

原创 前序——中序建樹

//指針變量在遞歸中不會改變 #include<stdio.h> #include<string.h> #include<stack> using namespace std; struct node { char data;

原创 HuffmanTree以及其編碼

#include<stdio.h> #include<limits.h> #include<stdlib.h> #include<string.h> struct node { int w; int lc,rc;

原创 二叉樹的遍歷--非遞歸操作

// 先序(附帶葉子標記)建樹 #include<iostream> #include<stdio.h> #include<stdlib.h> #include<string.h> #include<stack> #include<str

原创 2018-07-25 訓練1

A  -- Tricky Sum Description In this problem you are to calculate the sum of all integers from 1 to n, but you should

原创 字符數組_串的實現

// 在這裏預先定義,'/0'作爲串結束的標誌 #include<iostream> #include<stdio.h> #include<string.h> char* str = new char[100]; // 線性表傳入參數

原创 kmp算法

#include<iostream> #include<stdio.h> #include<string.h> #define maxSize 100 using namespace std; char *str = new char[1

原创 中跟遍歷__非遞歸操作

// 先序(附帶葉子標記)建樹 #include<iostream> #include<stdio.h> #include<stdlib.h> #include<string.h> #include<stack> #include<str

原创 先序列表建二叉樹(帶結束標識)

// 先序(附帶葉子標記)建樹 #include<iostream> #include<stdio.h> #include<stdlib.h> #include<string.h> #include<stack> #include<str

原创 鄰接表存圖

// 在(e<<1/2n(n-1))或者邊信息較多的情況下,鄰接表儲存方式具有優越性 // 鄰接表建立有向圖 #include<stdio.h> #define maxn 20 int Gra[maxn][maxn]; struct ar

原创 2018 CCPCfinal 感悟

第一次參加正式賽,其實心態還算穩,但是還是沒有逃脫打鐵的命運 首先說說第一天的熱身賽 熱身賽四道題,a了三道,簽到題+數學期望+dfs。數學題A的過程比較曲折,由於樣例給的很良心,其實也提供了一些思路,然後在這個過程中討論了一下,後來改變

原创 線性基

線性基的理解 基(百度百科):在線性代數中,基是描述、刻畫向量空間的基本工具。向量空間的基是它一個特殊的子集,基的元素稱爲向量基。向量空間中任意一個元素,都可以唯一地表示成基向量的線性組合。如果基中元素個數有限,那麼稱向量空間爲有限維向量

原创 皮克定理

計蒜客--三角形內點 在一個平面座標系中,我們可以選出三個不全在一條線上的點構成一個三角形。我們稱一個在三角形內(不包含三角形的邊上),橫縱座標皆爲整數的點位這個三角形的內點。 對於一個由(0,0)、(n,m)、(p,0)作爲頂點構成的三