原创 1.4 milk3 倒牛奶

廣度優先搜索,用數組記錄到達過的狀態   Mother's Milk Farmer John has three milking buckets of capacity A, B, and C liters. Each of the nu

原创 1.4 ariprog

暴力搜索,儘可能的提高效率   Arithmetic Progressions An arithmetic progression is a sequence of the form a, a+b, a+2b, ..., a+nb w

原创 1.4 clocks 枚舉

注意轉變思路,每個操作最多執行三次,所有解空間是4**9個,枚舉所有可能的操作 鐘錶a受影響的操作有1,3,4 用上述方法,判斷每個操作後的狀態 輸出即可   The Clocks IOI'94 - Day 2 Consider nine

原创 1.3 crypt1 簡單枚舉

Prime Cryptarithm The following cryptarithm is a multiplication problem that can be solved by substituting digits from

原创 1.5 numtri

Number Triangles Consider the number triangle shown below. Write a program that calculates the highest sum of numbers t

原创 一種靈活的find_if的第三個參數----函數對象

find_if的一個實現   template<class T,class Pred> T find_if(T first, T last, Pred pred) {      while(first!last && !pred(*fir

原创 1.5 超級肋骨質數

Superprime Rib Butchering Farmer John's cows always yields the best prime rib. You can tell prime ribs by looking at t

原创 1.1 transform 簡單模擬

自己寫的代碼很醜。 要注意旋轉和鏡像對應到二維數組時對應的操作   Transformations A square pattern of size N x N (1 <= N <= 10) black and white squa

原创 1.3 mixing milk 簡單貪心算法

Mixing Milk Since milk packaging is such a low margin business, it is important to keep the price of the raw product (m

原创 1.2 palsquare 轉化爲對應進制,再判斷是否爲迴文

Palindromic Squares Rob Kolstad Palindromes are numbers that read the same forwards as backwards. The number 12321 i

原创 1.2 namenum 遞歸枚舉

Name That Number Among the large Wisconsin cattle ranchers, it is customary to brand cows with serial numbers to please

原创 1.5 迴文質數

Prime Palindromes The number 151 is a prime palindrome because it is both a prime number and a palindrome (it is the sa

原创 1.3 Barn Repair 修理牛棚,還是貪心算法

書讀百遍,其意自見。   還是一道貪心算法的題目,貪心的核心就是從局部最優解推得全局最優解。   Barn Repair It was a dark and stormy night that ripped the roof and ga

原创 流迭代器

我們可以用這種方式容易的表示輸入和輸出流,例如:   ofstream_iterator<string> oo(cout);  //assigning to *oo is to write to cout *oo = "Hello,"; 

原创 一個月了

    不知不覺自己開這個博客已經一個月了,這真是值得銘記的一個月啊。     這個月前面那陣,自己還挺有狀態的,看書,做題,寫博客,不亦樂乎。可以校醫院那個江湖醫生打亂了這一切,她着實嚇了我一條。那幾天,自己真的是都沒有信心了,真是自己