摘要: 任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的: F(1)=1; F(2)=2; F(n)=F(n-1)+F(n-2)(n>=3); 所以,1,2,3,5,8,13……就是菲波那契数列。 在HDOJ上有不少相关的题目,比如1005 Fibonacci 阅读全文
posted @ 2017-07-25 21:04 X_1996 阅读(216) 评论(0) 推荐(0)
摘要: Alice and Bob decide to play a funny game. At the beginning of the game they pick n(1 <= n <= 10 6) coins in a circle, as Figure 1 shows. A move consi 阅读全文
posted @ 2017-07-25 21:02 X_1996 阅读(224) 评论(0) 推荐(0)
摘要: m堆石子,两人轮流取.只能在1堆中取.取完者胜.先取者负输出No.先取者胜输出Yes,然后输出怎样取子.例如5堆 5,7,8,9,10先取者胜,先取者第1次取时可以从有8个的那一堆取走7个剩下1个,也可以从有9个的中那一堆取走9个剩下0个,也可以从有10个的中那一堆取走7个剩下3个. Input输入 阅读全文
posted @ 2017-07-25 20:59 X_1996 阅读(197) 评论(0) 推荐(0)
摘要: 大学时光是浪漫的,女生是浪漫的,圣诞更是浪漫的,但是Rabbit和Grass这两个大学女生在今年的圣诞节却表现得一点都不浪漫:不去逛商场,不去逛公园,不去和AC男约会,两个人竟然猫在寝食下棋…… 说是下棋,其实只是一个简单的小游戏而已,游戏的规则是这样的: 1、棋盘包含1*n个方格,方格从左到右分别 阅读全文
posted @ 2017-07-25 20:58 X_1996 阅读(219) 评论(0) 推荐(0)
摘要: 有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。如果 阅读全文
posted @ 2017-07-25 20:57 X_1996 阅读(138) 评论(0) 推荐(0)
摘要: 有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。 I 阅读全文
posted @ 2017-07-25 20:56 X_1996 阅读(151) 评论(0) 推荐(0)
摘要: 简单的直接套公式 阅读全文
posted @ 2017-07-25 20:52 X_1996 阅读(135) 评论(0) 推荐(0)
摘要: N个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽"牌电动车从气球a开始到气球b依次给每个气球涂一次颜色。但是N次以后lele已经忘记了第I个气球已经涂过几次颜色了,你能帮他算出每个气球被涂过几次颜色吗? Input每个测试 阅读全文
posted @ 2017-07-25 20:50 X_1996 阅读(183) 评论(0) 推荐(0)
摘要: 动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动物都是A,B,C中的一种,但是我们并不知道它到底是哪一种。 有人用两种说法对这N个动物所构成的食物链关系进行描述: 第一种说法是"1 X Y",表示X和Y是同类。 第二种 阅读全文
posted @ 2017-07-25 20:49 X_1996 阅读(225) 评论(0) 推荐(0)
摘要: Volodya is an odd boy and his taste is strange as well. It seems to him that a positive integer number is beautiful if and only if it is divisible by 阅读全文
posted @ 2017-07-25 20:46 X_1996 阅读(166) 评论(0) 推荐(0)
摘要: 杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。 杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。 不吉利的数字为所有含有4或62的号码。例如: 62315 73418 8891 阅读全文
posted @ 2017-07-25 20:44 X_1996 阅读(120) 评论(0) 推荐(0)
摘要: Bessie is such a hard-working cow. In fact, she is so focused on maximizing her productivity that she decides to schedule her next N (1 ≤ N ≤ 1,000,00 阅读全文
posted @ 2017-07-25 20:42 X_1996 阅读(368) 评论(0) 推荐(0)
摘要: FJ has purchased N (1 <= N <= 2000) yummy treats for the cows who get money for giving vast amounts of milk. FJ sells one treat per day and wants to m 阅读全文
posted @ 2017-07-25 20:36 X_1996 阅读(235) 评论(0) 推荐(0)
摘要: "Help Jimmy" 是在下图所示的场景上完成的游戏。 场景中包括多个长度和高度各不相同的平台。地面是最低的平台,高度为零,长度无限。 Jimmy老鼠在时刻0从高于所有平台的某处开始下落,它的下落速度始终为1米/秒。当Jimmy落到某个平台上时,游戏者选择让它向左还是向右跑,它跑动的速度也是1米 阅读全文
posted @ 2017-07-25 20:33 X_1996 阅读(207) 评论(0) 推荐(0)
摘要: A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2, ..., xm > another 阅读全文
posted @ 2017-07-25 20:29 X_1996 阅读(150) 评论(0) 推荐(0)
摘要: Jesus, what a great movie! Thousands of people are rushing to the cinema. However, this is really a tuff time for Joe who sells the film tickets. He i 阅读全文
posted @ 2017-07-25 20:20 X_1996 阅读(377) 评论(0) 推荐(0)
摘要: Before ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irrever 阅读全文
posted @ 2017-07-25 20:18 X_1996 阅读(188) 评论(0) 推荐(0)
摘要: Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 100; 1 <= M <= 阅读全文
posted @ 2017-07-25 20:12 X_1996 阅读(136) 评论(0) 推荐(0)
摘要: 符号三角形的 第1行有n个由“+”和”-“组成的符号 ,以后每行符号比上行少1个,2个同号下面是”+“,2个异 号下面是”-“ 。计算有多少个不同的符号三角形,使其所含”+“ 和”-“ 的个数相同 。 n=7时的1个符号三角形如下: + + - + - + + + - - - - + - + + + 阅读全文
posted @ 2017-07-25 20:08 X_1996 阅读(489) 评论(0) 推荐(0)
摘要: “连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看,咨询了同学的意见,连线不能从 阅读全文
posted @ 2017-07-25 19:55 X_1996 阅读(144) 评论(0) 推荐(0)
摘要: Being a programmer, you like arrays a lot. For your birthday, your friends have given you an array a consisting of n distinct integers. Unfortunately, 阅读全文
posted @ 2017-07-25 19:52 X_1996 阅读(145) 评论(0) 推荐(0)
摘要: Little Dima misbehaved during a math lesson a lot and the nasty teacher Mr. Pickles gave him the following problem as a punishment. Find all integer s 阅读全文
posted @ 2017-07-25 19:25 X_1996 阅读(257) 评论(0) 推荐(0)
摘要: You have r red, g green and b blue balloons. To decorate a single table for the banquet you need exactly three balloons. Three balloons attached to so 阅读全文
posted @ 2017-07-25 19:18 X_1996 阅读(189) 评论(0) 推荐(0)
摘要: Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Be 阅读全文
posted @ 2017-07-25 19:07 X_1996 阅读(173) 评论(0) 推荐(0)