原创 USACO 2.2 Subset Sums

Subset Sums JRM For many sets of consecutive integers from 1 through N (1 <= N <= 39), one can partition the set into t

原创 Python模塊: collections學習

轉載自:http://www.zlovezl.cn/articles/collections-in-python/ 閱讀官方文檔和模塊源碼:https://docs.python.org/2/library/collections.htm

原创 USACO 2.1 Healthy Holsteins

Farmer John prides himself on having the healthiest dairy cows in the world. He knows the vitamin content for one scoo

原创 USACO 2.1 Hamming Codes

Given N, B, and D: Find a set of N codewords (1 <= N <= 64), each of length B bits (1 <= B <= 8), such that each of the

原创 Python中實現map+鏈表功能的方法

今天在做畢設的時候碰到一個問題:需要一種數據結構實現以下的這種結構(圖片來自網絡): 其實就是將n個元素按照某種規則進行hash,並掛在對應的key下面(key的範圍是從0到2^22) 我第一反應就是使用python中的dict,結構爲

原创 python中matplotlib的顏色及線條控制

下次用python畫圖的時候選色選點都可以直接參考這邊,牛逼! 原文章鏈接: http://www.cnblogs.com/darkknightzh/p/6117528.html 參考網址: http://stackoverflo

原创 USACO 2.2 Preface Numbering

A certain book's prefaces are numbered in upper case Roman numerals. Tradi

原创 深入理解Java中的final關鍵字

Java中的final關鍵字非常重要,它可以應用於類、方法以及變量。這篇文章中我將帶你看看什麼是final關鍵字?將變量,方法和類聲明爲final代表了什麼?使用final的好處是什麼?最後也有一些使用final關鍵字的實例。final

原创 Python中用list創建二維數組的方法

b =[[1 for x in range(n)] for y in range(m)] 上面一句就初始化了一個m*n的二維數組,且初始值全爲1

原创 使用結巴分詞後程序打包失敗

做畢設時又碰到了一個難題,使用結巴分詞和analyse後沒法正常打包程序。使用py2exe得不到.exe文件,使用PyInstaller程序報錯。 報錯信息如下(圖片來自文獻1): 後來參考了文獻1和文獻2後知道原來是因爲import

原创 USACO 2.1 The Castle

In a stroke of luck almost beyond imagination, Farmer John was sent a ticket to the Irish Sweepstakes (really a lottery

原创 USACO 2.2 Runaround Numbers

題目: Runaround numbers are integers with unique digits, none of which is zero (e.g., 81362) that also have an interesti

原创 開始寫博客

說起來也慚愧,已經是條大四狗了,但是還是C渣渣,編程的小白。和我的其他同學比起來,自己的編程能力一直沒有很大的提高。當然這和我自身的不努力有很大關係

原创 Python中的堆數據結構——heap模塊

>>> import heapq >>> help(heapq) Help on module heapq: NAME heapq - Heap queue algorithm (a.k.a. priority queue).

原创 [Leetcode] 39. Combination Sum

Given a set of candidate numbers (C) (without duplicates) and a target number (T), find all unique combinations in C