Ray's playground

 

2011年3月11日

Project Euler Problem 21

摘要: Let d(n) be defined as the sum of proper divisors ofn(numbers less thannwhich divide evenly inton).If d(a) =band d(b) =a, whereab, thenaandbare an amicable pair and each ofaandbare called amicable numbers.For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; therefo 阅读全文

posted @ 2011-03-11 22:40 Ray Z 阅读(194) 评论(0) 推荐(0) 编辑

Welcome to Software Construction(Chapter 1 of Code Complete)

摘要: Developing computer software can be a complicated process, and in the last 25 years, researchers have identified numerous distinct activities that go into software development. They include Problem definition Requirements development Construction planning Software architecture, or high-level design 阅读全文

posted @ 2011-03-11 22:03 Ray Z 阅读(138) 评论(0) 推荐(0) 编辑

Project Euler Problem 15

摘要: Starting in the top left corner of a 22 grid, there are 6 routes (without backtracking) to the bottom right corner.How many routes are there through a 2020 grid?1#include<iostream>2usingnamespacestd;34#definenum415longlongPascalTriangle[num][num];67voidCalcPascalTriangle()8{9PascalTriangle[0][ 阅读全文

posted @ 2011-03-11 17:41 Ray Z 阅读(200) 评论(0) 推荐(0) 编辑

Common Objective-C Patterns(Chapter 4 of Objective-C Phrasebook)

摘要: 1#import"Singleton.h"234@implementationSingleton5staticSingleton*instance;67-(id)init8{9self=[superinit];10if(self){11//Initializationcodehere.12}1314returnself;15}1617+(id)alloc18{19@synchronized([Singletonclass])20{21instance=[superalloc];22returninstance;23}24returnnil;25}2627+(Singleto 阅读全文

posted @ 2011-03-11 16:25 Ray Z 阅读(216) 评论(0) 推荐(1) 编辑

Creating NSFormatters(Chapter 26 of Cocoa Programming for Mac OS X)

摘要: 1#import"ColorFormatter.h"23@interfaceColorFormatter()45-(NSString*)firstColorKeyForPartialString:(NSString*)string;67@end89@implementationColorFormatter1011-(id)init12{13[superinit];14colorList=[[NSColorListcolorListNamed:@"Apple"]retain];15returnself;16}1718-(void)dealloc19{20[ 阅读全文

posted @ 2011-03-11 09:19 Ray Z 阅读(220) 评论(0) 推荐(0) 编辑

导航