摘要: There is a hill with n holes around. The holes are signed from 0 to n-1. A rabbit must hide in one of the holes. A wolf searches the rabbit in anticlo 阅读全文
posted @ 2017-07-30 21:11 山杉三 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 监狱有连续编号为1...N的N个房间,每个房间关押一个犯人,有M种宗教,每个犯人可能信仰其中一种。如果相邻房间的犯人的宗教相同,就可能发生越狱,求有多少种状态可能发生越狱 Input 输入两个整数M,N.1<=M<=10^8,1<=N<=10^12 Output 可能越狱的状态数,模100003取余 阅读全文
posted @ 2017-07-30 20:59 山杉三 阅读(136) 评论(0) 推荐(0) 编辑
摘要: Given a specified total t and a list of n integers, find all distinct sums using numbers from the list that add up to t. For example, if t=4, n=6, and 阅读全文
posted @ 2017-07-30 18:20 山杉三 阅读(418) 评论(0) 推荐(0) 编辑
摘要: A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacen 阅读全文
posted @ 2017-07-30 10:33 山杉三 阅读(909) 评论(0) 推荐(0) 编辑
摘要: 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数 阅读全文
posted @ 2017-07-30 10:18 山杉三 阅读(155) 评论(0) 推荐(0) 编辑