原创 projecteuler---->problem=15----Lattice paths

Starting in the top left corner of a 22 grid, and only being able to move to the right and down, there are exactly 6 r

原创 projecteuler---->problem=14----Longest Collatz sequence

title: The following iterative sequence is defined for the set of positive integers: n n/2 (n is even)n 3n + 1 (n is

原创 LeetCode 第一題剪綵自己的leetCode之路

Reverse Words in a String   Given an input string, reverse the string word by word. For example, Given s = "the s

原创 projecteuler---->problem=13----Large sum

title: Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. 37107287533902102798797

原创 projecteuler---->problem=16----Power digit sum

215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 21000? 翻譯

原创 projecteuler---->problem=18----Maximum path sum I

By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from t

原创 projecteuler---->problem=19----Counting Sundays

You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday.

原创 編譯器DIY——讀文件

編譯器的前端詞法分析:將源文件解析成一個個的單詞流,爲語法分析做準備。 在詞法分析階段,我們要做的就是將詞分出來,並且確定單詞的類型,一般的程序設計語言的單詞符號可以份爲以下5種: 1.關鍵字,如int,long等 2.標識符,用來表示各

原创 mac 配置 tomcat

第一步:下載Tomcat       這裏Himi下載的tomcat version:7.0.27 直接上下載地址:http://tomcat.apache.org/download-70.cgi 直接下載如下選中即可: 第二步

原创 projecteuler---->problem=22----Names scores

sing names.txt (right click and 'Save Link/Target As...'), a 46K text file

原创 projecteuler---->problem=20----Factorial digit sum

n! means n (n 1) ... 3 2 1 For example, 10! = 10 9 ... 3 2 1 = 3628800, and the sum of the digits in the nu

原创 編譯器DIY之———統計英文文本中的單詞數,字符數和行數

咳咳,這一章節應該是連載編譯器的DIY的,可是在做DIY之前先用flex 來練練手,對於後面的理解有幫助作用。 在word 中我經常看到有一個單詞統計的功能,那麼是怎麼來實現的了,當然第一個念頭就是遍歷整個文本依據換行和空格對字符串進行分

原创 編譯器DIY——詞法分析

在上一篇文章中已經介紹了讀文件的操作,那麼這一篇文章中將會仔細解釋詞法分析。 在源文件中解析出的單詞流必須識別爲保留字,標識符,常量,操作符和界符五大類 1.顯然我們需要列舉出所有的保留字,而這裏與保留字相似的那麼就是標識符,在C語言中,

原创 projecteuler---->problem=25----1000-digit Fibonacci number

問題描述: The Fibonacci sequence is defined by the recurrence relation: Fn = Fn1 + Fn2, where F1 = 1 and F2 = 1. Hence t

原创 projecteuler---->problem=21----Amicable numbers

Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b a