原创 排序算法理解和比較

1.怎麼衡量一個排序算法的優劣? 時間複雜度、空間複雜度、穩定性 2.什麼是時間複雜度? 假設機器執行一行基礎代碼需要執行一次運算 舉例①: #include<iostream> using namespace std; int mai

原创 2015年QDU數據庫期末試題

設有學生-課程數據庫,數據庫模式爲: 學生Student(學號sno,姓名sname,性別ssex,年齡sage,所在系sdept) 課程Course(課程號cno,課程名cname,先行課cpno,學分ccredit) 選課SC(學號s

原创 關於觸發器的定義和使用的一些理解

按照第五版數據庫系統概論的教材的例題在SQL sever上寫,無一例外全部報錯。 借鑑某些博客和自己的摸索探索出了一個模板和幾個套路。 模板: create trigger xxx on (table) --xxx是觸發器的名字,tab

原创 矩陣快速冪和幾個應用

模板: #define maxn 1005 struct Matrix { int m[maxn][maxn]; }a,b,ans,res; void init() { for(int i = 1; i <= n; i

原创 幾個數論基礎水題

1.自除整數 對一個整數n,如果其各個位數的數字相加得到的數m能整除n,則稱n爲自整除數.例如21,21%(2+1)==0,所以21是自整除數.現求出從10到n(n < 100)之間的所有自整除數. Input 有一行,整數n,(10 <

原创 數論基礎題

1.又見GCD 有三個正整數a,b,c(0<a,b,c<10^6),其中c不等於b。若a和c的最大公約數爲b,現已知a和b,求滿足條件的最小的c。 Input 第一行輸入一個n,表示有n組測試數據,接下來的n行,每行輸入兩個正整數a,b。

原创 快速冪及幾個應用

快速冪:快速求a^b 核心代碼: int q_pow(int a,int b) { int res = 1; while(b) { if(b&1)//如果b是奇數,那麼就乘一下底數

原创 CodeForces 2A - Winner(map的應用)

The winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the e

原创 【LeetCode】84. Largest Rectangle in Histogram(單調棧)

A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal

原创 UVA 1476 Error Curves (三分)

Josephina is a clever girl and addicted to Machine Learning recently. She pays much attention to a method called Linear

原创 Windows Message Queue(優先隊列)

Message queue is the basic fundamental of windows system. For each process, the system maintains a message queue. If so

原创 ZOJ-1061-Web Navigation (棧的應用)

Standard web browsers contain features to move backward and forward among the pages recently visited. One way to implem

原创 UVA 10815 Andy's First Dictionary(set+sstream)

Andy, 8, has a dream - he wants to produce hisvery own dictionary. This is not an easy task forhim, as the number of wo

原创 高精度加法(java中bigdecimal應用)

Bigdecimal在import java.math.BigDecimal這個包中 如果定義兩個大數a,b; 相加: a.add(b) 相乘:a.multiply(b) import java.math.BigDecimal; imp

原创 2019天梯賽-L2-3

L2-3 深入虎穴 (25 分) 著名的王牌間諜 007 需要執行一次任務,獲取敵方的機密情報。已知情報藏在一個地下迷宮裏,迷宮只有一個入口,裏面有很多條通路,每條路通向一扇門。每一扇門背後或者是一個房間,或者又有很多條路,同樣是每條路通