原创 結構體:按成績排序(sort排序 || 結構體內嵌比較函數)

Description 定義一個學生結構體,含學號(一維字符數組)、姓名、成績(整型)。從鍵盤輸入n(n<20),再輸入n個學生的信息,按學生成績從小到大順序輸出學生信息。 Input 輸入一個n,接着輸入n個學生的信息。 Out

原创 A Simple Problem with Integers(區間修改,lazy標記)

POJ-3468 Description You have N integers, A1, A2, … , AN. You need to deal with two kinds of operations. One type o

原创 uva-最短路(UVa 247、UVa 10048 、UVa 658)

uva 274 #include <bits/stdc++.h> #define endl "\n" #define LL long long #define INF 0x3f3f3f3f #define IOS ios::sync_

原创 UVA 1593 Alignment of Code

#include <bits/stdc++.h> #define endl "\n" #define LL long long #define IOS ios::sync_with_stdio(false);cin.tie(0);c

原创 UVA 1594 Ducci Sequence

#include <bits/stdc++.h> #define endl "\n" #define LL long long #define IOS ios::sync_with_stdio(false);cin.tie(0);c

原创 HDU 3478 Catch(並查集 + 二分圖)

A thief is running away! We can consider the city where he locates as an undirected graph in which nodes stand for cr

原创 Nested Segments(離散+樹狀數組)

You are given n segments on a line. There are no ends of some segments that coincide. For each segment find the numbe

原创 Number Sequence(hash)

Given two sequences of numbers : a[1], a[2], … , a[N], and b[1], b[2], … , b[M] (1 <= M <= 10000, 1 <= N <= 1000000).

原创 不要62(數位dp + 註解)

HDU-2089 Description 杭州人稱那些傻乎乎粘嗒嗒的人爲62(音:laoer)。 杭州交通管理局經常會擴充一些的士車牌照,新近出來一個好消息,以後上牌照,不再含有不吉利的數字了,這樣一來,就可以消除個別的士司機和乘客的

原创 windy數(數位dp)

windy定義了一種windy數。不含前導零且相鄰兩個數字之差至少爲2的正整數被稱爲windy數。 windy想知道, 在A和B之間,包括A和B,總共有多少個windy數? Input   包含兩個整數,A B。 Output   一

原创 敵兵佈陣 (單點修改)

HDU-1166 Description  C國的死對頭A國這段時間正在進行軍事演習,所以C國間諜頭子Derek和他手下Tidy又開始忙乎了。A國在海岸線沿直線佈置了N個工兵營地,Derek和Tidy的任務就是要監視這些工兵營地的活動

原创 Stars(樹狀數組)

HDU-2642  Yifenfei is a romantic guy and he likes to count the stars in the sky.  To make the problem easier,we consi

原创 統計難題(map / 字典樹)

HDU1251 Problem Description  Ignatius最近遇到一個難題,老師交給他很多單詞(只有小寫字母組成,不會有重複的單詞出現),現在老師要他統計出以某個字符串爲前綴的單詞數量(單詞本身也是自己的前綴). In

原创 A Simple Problem with Integers

POJ-3468 Description You have N integers, A1, A2, … , AN. You need to deal with two kinds of operations. One type of

原创 Dungeon Master(BFS)

Description  You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit c