原创 HDU-1198 Farm Irrigation (並查集)

題目鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=1198 並查集找幾個不是同一個聯通的 #include<cstdio> #include<iostream> #define N 55 us

原创 HDU-1024(動規)Max Sum Plus Plus

題目鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=1024 題意過程:(轉自https://blog.csdn.net/pmt123456/article/details/52695470 感謝

原创 HDU-1301 Jungle Roads (最小生成樹-Prim)【0MS】

題目鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=1301 #include<iostream> #include<cstdio> #include<cstring> #define inf

原创 面對現實吧,孩子!

           你是糾結還是在害怕?            是在糾結要不要考研還是不敢進行考研複習?            是在糾結大三結束要不要去實習還是因爲自己根本沒能力去找工作?            其實細想都是後者!  

原创 UVA-11572 Unique Snowflakes (STL)

Emily the entrepreneur has a cool business idea: packaging and selling snowflakes. She has devised a machine that captu

原创 UVA-11134 Fabled Rooks (貪心)

We would like to place n rooks, 1 ≤ n ≤ 5000, on a n × n board subject to the following restrictions • The i-th rook ca

原创 HDU-2829 Lawrence(dp+四邊形優化)

題目連接:http://acm.hdu.edu.cn/showproblem.php?pid=2829 #include<cstdio> #include<iostream> #include<cstring> #define N 10

原创 HDU-2540 遮擋判斷(貪心+數學)

題目鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=2540 #include<cstdio> #include<iostream> #include<cstring> #include<alg

原创 競賽篇-----最大連續和問題

1)首先最簡單的就是模擬時間複雜度是O(n^3) /* 最大連續和問題 O(n^3) */ #include<cstdio> #include<iostream> using namespace std; int main() { i

原创 UVA-1605 Building for UN

The United Nations has decided to build a new headquarters in Saint Petersburg, Russia. It will have a form of a rectan

原创 HDU-2539 點球大戰(字符串處理)

題目鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=2539 #include<cstdio> #include<iostream> #include<cstring> using namesp

原创 競賽篇-----二分查找

/* 二分查找,左閉右開區間 注意查找的數組一定是有序的 */ #include<cstdio> #include<iostream> #include<algorithm> #define N 1005 using namespace

原创 UVA-1152 (二分) 4 Values whose Sum is 0

The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruple

原创 HDU-2526 浪漫手機(下一行的每個字符由上一行的頂部三個決定,)

題目鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=2526 思路: 自己找出範圍是m<=1000,每行的左右都是0,但是不能輸出,上一行的字符決定下一行。 #include<cstdio> #

原创 UVA-120Stacks of Flapjacks

Stacks and Queues are often considered the bread and butter of data structures and find use in architecture, parsing, o