摘要: 题目:Runaround NumbersRunaround numbers are integers with unique digits, none of which is zero (e.g., 81362) that also have an interesting property, exemplified by this demonstration:If you start at the left digit (8 in our number) and count that number of digits to the right (wrapping back to the fir 阅读全文
posted @ 2012-08-25 21:49 萧若离 阅读(175) 评论(0) 推荐(0)
摘要: 题目:Hamming CodesRob KolstadGiven 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 codewords is at least Hamming distance of D (1 <= D <= 7) away from each of the other codewords. The Hamming distance between a pair of 阅读全文
posted @ 2012-08-06 11:10 萧若离 阅读(168) 评论(0) 推荐(0)
摘要: 题目:Sorting a Three-Valued SequenceIOI'96 - Day 2Sorting is one of the most frequently performed computational tasks. Consider the special sorting problem in which the records to be sorted have at mostthreedifferent key values. This happens for instance when we sort medalists of a competition acc 阅读全文
posted @ 2012-07-30 10:51 萧若离 阅读(179) 评论(0) 推荐(0)
摘要: 题目:Dungeon MasterTime Limit:1000MSMemory Limit:65536KTotal Submissions:11707Accepted:4546DescriptionYou are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south 阅读全文
posted @ 2012-07-25 20:11 萧若离 阅读(259) 评论(0) 推荐(0)
摘要: 题目:棋盘问题Time Limit : 2000/1000ms (Java/Other)Memory Limit : 20000/10000K (Java/Other)Total Submission(s) : 2Accepted Submission(s) : 2Problem Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在 阅读全文
posted @ 2012-07-25 16:08 萧若离 阅读(231) 评论(0) 推荐(0)
摘要: 题目:Ordered FractionsConsider the set of all reduced fractions between 0 and 1 inclusive with 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 阅读全文
posted @ 2012-07-24 21:02 萧若离 阅读(191) 评论(0) 推荐(0)
摘要: 这个题目做完,就正式结束Chapter 1的内容进入2了,心情大爽,就是赶脚速度有点太慢了。题目:Prime PalindromesThe number 151 is a prime palindrome because it is both a prime number and a palindrome (it is the same number when read forward as backward). Write a program that finds all prime palindromes in the range of two supplied numbers a and 阅读全文
posted @ 2012-07-23 10:45 萧若离 阅读(173) 评论(0) 推荐(0)
摘要: 题目:Saving Princess claire_Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 705Accepted Submission(s): 257Problem DescriptionPrincess claire_ was jailed in a maze by Grand Demon Monster(GDM) teoy.Out of anger, little Prince ykwd decides to break into 阅读全文
posted @ 2012-07-21 16:47 萧若离 阅读(192) 评论(0) 推荐(0)
摘要: 题目:Checker ChallengeExamine the 6x6 checkerboard below and note that the six checkers are arranged on the board so that one and only one is placed in each row and each column, and there is never more than one in any diagonal. (Diagonals run from southeast to northwest and southwest to northeast and 阅读全文
posted @ 2012-07-18 22:11 萧若离 阅读(187) 评论(0) 推荐(0)
摘要: 题目:由于今晚usaco崩溃了,所以补贴题目了。大意是给一个N(1<=N<=8),从小到大输出所有满足条件的N位数。条件:1,此N位数是素数。2,此N位数前面的都是素数。例如:三位数233,是素数,去掉最后一位3,剩余23依然是素数,再去掉一位,剩余2还是素数。看到题目感觉是dp,后面的由前面的添加转化而来,但是在想办法存储前面时出现了问题,不知道怎么下笔。最后直接用8个if暴力过掉了。后来看解题报告,根本无需记录,直接用递归算就行了,表示还是太嫩了,没经验。代码:这么丑陋的代码不看也罢看完解题报告,感到无比汗颜,直接递归写,不用存储N-1位,代码估计只有40行左右。今早起来,回想 阅读全文
posted @ 2012-07-17 22:01 萧若离 阅读(209) 评论(0) 推荐(0)