2.2.3 Runaround Numbers

摘要: Runaround Numbers Runaround numbers are integers with unique digits, none of which iszero (e.g., 81362) that also have an interesting property, exemplifiedby this demonstration:If you start at the left digit (8 in our number) and count thatnumber of digits to the right (wrapping back to the first d. 阅读全文
posted @ 2013-08-22 12:07 makeecat 阅读(197) 评论(0) 推荐(0) 编辑

2.2.2 Subset Sums

摘要: Subset SumsJRMFor many sets of consecutive integers from 1 through N (1 >1; if v and 1=1 then begin writeln(0); close(output);halt;end; v:=v>>1; f[1,1]:=1;f[1,0]:=1; for i:=2 to n do for j:=0 to v do if j-i>=0 then f[i,j]:=f[i-1,j]+f[i-1,j-i] else f[i,j]:=f[i-1,j];//Êý× 阅读全文
posted @ 2013-08-22 12:06 makeecat 阅读(327) 评论(0) 推荐(0) 编辑

2.2.1 Preface Numbering

摘要: Preface Numbering A certain book's prefaces are numbered in upper case Roman numerals.Traditional Roman numeral values use a single letter to represent acertain subset of decimal numbers. Here is the standard set: I 1 L 50 M 1000 V 5 C 100 X 10 D 500As... 阅读全文
posted @ 2013-08-22 12:05 makeecat 阅读(200) 评论(0) 推荐(0) 编辑

Dynamic Programming

摘要: Dynamic Programming IntroductionDynamic programming is a confusing name for a programming technique that dramatically reduces the runtime of algorithms: from exponential to polynomial. The basic idea is to try to avoid solving the same problem or subproblem twice. Here is a problem to demonstrate it 阅读全文
posted @ 2013-08-22 12:04 makeecat 阅读(220) 评论(0) 推荐(0) 编辑

Data Structures

摘要: Data Structures PrerequisiteGraph TheoryHow to pick the perfect data structureThere are several aspect of data structures to consider when selecting the proper way to represent the data for a problem.Will it work?If the data struct won't work, it's not helpful at all. Ask yourself what quest 阅读全文
posted @ 2013-08-22 12:03 makeecat 阅读(168) 评论(0) 推荐(0) 编辑

2.1.5 Hamming Codes

摘要: Hamming CodesRob Kolstad Given N, B, and D: Find a set of N codewords (1 0 do begin if x and 1=1 then inc(i);x:=x>>1;end; if i>=d then exit(true);exit(false);end;begin assign(input,'hamming.in');reset(input); assign(output,'hamming.out');rewrite(output); readln(N,B,D);close( 阅读全文
posted @ 2013-08-22 12:01 makeecat 阅读(231) 评论(0) 推荐(0) 编辑

2.1.4 Healthy Holsteins

摘要: Healthy HolsteinsBurch & KolstadFarmer John prides himself on having the healthiest dairy cowsin the world. He knows the vitamin content for one scoop of eachfeed type and the minimum daily vitamin requirement for the cows.Help Farmer John feed his cows so they stay healthy while minimizingthe n 阅读全文
posted @ 2013-08-22 11:59 makeecat 阅读(236) 评论(0) 推荐(0) 编辑

2.1.3 Sorting a Three-Valued Sequence

摘要: Sorting a Three-Valued Sequence IOI'96 - Day 2 Sorting is one of the most frequently performed computational tasks.Consider the special sorting problem in which the records to be sortedhave at most three different key values. This happens for instancewhen we sort medalists of a competition accor 阅读全文
posted @ 2013-08-22 11:57 makeecat 阅读(227) 评论(0) 推荐(0) 编辑

2.1.2 Ordered Fractions

摘要: Ordered Fractions Consider the set of all reduced fractions between 0 and 1 inclusivewith denominators less than or equal to N.Here is the set when N = 5:0/1 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 1/1Write a program that, given an integer N between 1 and 160 inclusive, prints the fractions in order of. 阅读全文
posted @ 2013-08-22 11:56 makeecat 阅读(184) 评论(0) 推荐(0) 编辑

2.1.1 The Castle

摘要: The CastleIOI'94 - Day 1 In a stroke of luck almost beyond imagination, Farmer John wassent a ticket to the Irish Sweepstakes (really a lottery) for hisbirthday. This ticket turned out to have only the winning numberfor the lottery! Farmer John won a fabulous castle in the Irishcountryside. Brag 阅读全文
posted @ 2013-08-22 11:55 makeecat 阅读(178) 评论(0) 推荐(0) 编辑