原创 BZOJ 1611: [Usaco2008 Feb]Meteor Shower流星雨

1611: [Usaco2008 Feb]Meteor Shower流星雨 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 1635  Solved: 702 [Submit][Status

原创 位運算功能大全

去掉最後一位: 示例:(101101⇒10110)(101101⇒10110) 位運算:x>>1x>>1 在最後加一個0 示例:(101101⇒1011010)(101101⇒1011010) 位運算:x<<1x<<1 在最後加一

原创 [UVa 201]Squares 正方形,ACM/ICPC World Finals 1990

A children’s board game consists of a square array of dots that contains lines connecting some of the pairs of adjacen

原创 C++ STL map(映射)

頭文件:#include<map>,當然,萬能庫就不用我多說了吧。。 介紹:map容器是一個鍵 (key) 到值 (value) 的映射。因爲重載了 [ ] 運算符,map像是數組的“高級版”。map的key和value可以是任意類型,其

原创 [UVa 1593] Alignment of Code 代碼對齊

題意簡述:輸入若干行代碼,要求各列單詞的左邊界對齊且儘量靠左。單詞之間至少要空一格。每個單詞不超過80個字符,每行不超過180個字符,一共最多1000行。 code: #include<bits/stdc++.h> using name

原创 C++ STL vector(向量)用法詳解

轉自博客園:https://www.cnblogs.com/zhonghuasong/p/5975979.html 介紹 vector是表示可變大小數組的序列容器。 就像數組一樣,vector也採用的連續存儲空間來存儲元素。也就是意味着

原创 C++ STL set(集合)

引入: 集合和映射也是兩個常用的容器。set就是數學上的集合——每個元素最多隻出現一次。和sort一樣,自定義類型也可以構造set,但同樣必須定義“小於”運算符。 頭文件: #include<set>(當然,如果願意,你也可以用#in

原创 [UVa 213]Message Decoding,ACM/ICPC World Finals 1991 信息解碼

Some message encoding schemes require that an encoded message be sent in two parts. The first part, called the header,

原创 [UVa 133]The Dole Queue 救濟金髮放

In a serious attempt to downsize (reduce) the dole queue, The New National Green Labour Rhinoceros Party has decided o

原创 [SHOI2008]堵塞的交通traffic

Problem : [SHOI2008]堵塞的交通traffic Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 6  Solved: 5 [Submit][Status][Web B

原创 淺談Trie樹(字典樹)

定義:Trie,又稱字典樹,是一種用於實現字符串快速檢索的多叉樹結構。Trie的每個節點都擁有若干個字符指針,若在插入或檢索字符串時掃描到一個字符cc ,就沿着當前節點的cc 這個字符指針,走向該指針指向的節點。 基本特點: 每條樹邊

原创 [UVa 489]Hangman Judge 劊子手遊戲

In “Hangman Judge,” you are to write a program that judges a series of Hangman games. For each game, the answer to the

原创 1640: [Usaco2007 Nov]Best Cow Line 隊列變換

1640: [Usaco2007 Nov]Best Cow Line 隊列變換 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 984  Solved: 512 [Submit][Stat

原创 Poj1995 Raising Modulo Numbers(快速冪)

Description People are different. Some secretly read magazines full of interesting girls’ pictures, others creat e an

原创 [入門oj1531]士兵訓練

Description N個士兵排成一隊進行軍事訓練,每個士兵的等級用1…K範圍內的數來表示,長官每隔1小時就隨便說出M個等級a1,a2…am(1≤ai≤K,M個等級中允許有重複),如果這M個等級組成的序列是排成一隊的N個士兵等級序列的