一些蒟蒻认为的好题(趣题)【更新中】

Question 1

来源:uva1657

Description

很久很久以前有鬼谷先生,他有两位弟子,一位叫孙膑,另一位叫庞涓,一天鬼谷子想考一考他的两个徒弟,他在心中想了两个正整数,我们用x和y代替,其中 1x<yn ,然后鬼谷先生公布了这个n,接着它将两个数的和告诉了孙膑,将两个数的积告诉了庞涓,然后依次循环询问孙膑庞涓两人是否知道这两个数是多少,(总是先问孙膑),例如:
鬼谷先生:n=10,然后悄悄告诉孙膑x+y=9,接着又悄悄告诉庞涓x*y=18。
孙膑:不知道。
庞涓:不知道。
孙膑:不知道。
庞涓:不知道。
孙膑:知道了,x=3,y=6。
两人一共说了m次不知道后,下一个人算出了答案。孙膑和庞涓都是绝顶聪明且精于计算,现在鬼谷先生也想考一考你,你的任务就是根据n,m计算出所有可能的(x,y)。

Input

输入文件的第一行包括两个正整数n,m。 2n200 , 0m100

Output

第一行一个ans代表有多少种可能,接下来ans行。每行两个数x,y,代表满足条件的一对数,(以任意顺序输出)

Sample Input

输入:
10 4

Sample Output

输出:
3
2 5
3 6
3 10
另一种可通过的输出(共有六种合法的输出)
3
2 5
3 10
3 6

Question2

来源:uva1677

Description

在穿过城市的自行车之旅中,花费了大量的时间来等待交通信号灯。如果只有你可以减少这个丢失的时间,也许你最终能更快到达目的地。请注意,在红色交通灯上损失的时间不仅仅在于站立的时间还在灯光下灯变绿后,自行车加速时会增加额外的时间。在这个问题上,我们假设一个自行车旅行的理论模型,基于以下规则:
•自行车前进或静止,但不会向后移动。自行车没有有最大的速度,但你可以放心,不会涉及相对论的影响这个问题。
•自行车可以以每秒0.5米的最大加速度提高速度。
•自行车可以立即将其速度降低到零到当前速度之间的任何值。
•自行车不能穿过红灯。
•每个交通信号灯都会根据固定的连续重复的节奏变成红色和绿色。 (这些
交通信号灯不会变黄。)
很明显,理论模型在几个方面偏离现实。例如,
荷兰骑自行车的人几乎从未停止过红灯。此外,建模的自行车可以减速无限
率,而大多数学生的自行车没有制动能力。我们忽略这些
现在的差异,着重于理论。
问题
在零速度的时刻T = 0的时刻,你在X = 0的位置,您正在用自行车站立。
你很匆忙,想要尽快到达X = Xdest点。
您的任务是找到加速和制动的模式,以便您安全地通过所有交通灯
并尽快到达Xdest。
允许在行程中的任何时候制动和/或停止,包括(当然)红色交通
灯。

Input

每个测试用例的输入包括以下项目:
一行包含一个浮点数Xdest和一个整数L.
Xdest是以米为单位的总距离(1≤Xdest≤10000);
L是要通过的交通灯的数量(0≤L≤10)。
描述交通信号灯的L行,按照X位置升序列出。
这些行中的每一行都包含3个浮点数:
Xi,从起点(0 < Xi < Xdest)的交通信号灯的位置;
Ri,该交通灯的每个红灯时段的持续时间(秒)(10≤Ri≤500);
Gi,该交通灯的每个绿光周期的持续时间(秒)(10≤Gi≤500)。
时间T = 0时,所有红绿灯都变红。
交通灯i在T = Ri第一次变绿。
同一位置上从未有一个以上的交通信号灯。

Output

对于每个测试数据,写入一行包含浮点数的输出:最早的时间
骑车人可以到达目的地。
答案应舍入小数点后的3位数字。
有spj

Sample Input

410.0 2
200.0 15.0 15.0
225.0 31.0 10.0
410.0 2
200.0 15.0 15.0
225.0 35.1 15.0
410.0 2
200.0 15.0 15.0
225.0 45.0 10.0

Sample Output

41.497
52.623
57.213
说明:这是从uva上复制过来然后,用翻译之后再加以修改的结果,如果你英文好,可以看原文。
On a bicycle trip through the city, a significant amount of time is spent waiting for traffic lights. If
only you could reduce this lost time, maybe you would finally manage to get to class in time for the
first lecture.
Note that the amount of time lost on a red traffic light is more than just the time spent standing
still at the light. After the light turns green, additional time is lost while the bicycle accelerates.
In this problem, we assume a theoretical model of a bicycle trip, based on the following rules:
• The bicycle moves forward or stands still, but it never moves backwards. The bicycle does not
have a maximum speed, but you may rest assured that relativistic effects will not be involved in
this problem.
• The bicycle can increase speed at a maximum acceleration of 0.5 meters per second per second.
• The bicycle can instantaneously reduce its speed to any value between zero and the current speed.
• The bicycle cannot go through a red light.
• Each traffic light turns red and green according to a fixed, continuously repeating rhythm. (These
traffic lights don’t turn yellow.)
It should be obvious that the theoretical model deviates from reality in several ways. For example,
Dutch cyclists hardly ever stop for red lights. Also, the modelled bicycle can decelerate at an infinite
rate, while most student’s bikes do not have any braking capability to speak of. We ignore these
differences for now and focus on the theory.
Problem
You are standing with your bike at point X = 0 at time T = 0 with zero speed.
You are in an enormous hurry and would like to arrive at point X = Xdest as soon as possible.
Your task is to find a pattern of accelerating and braking such that you safely pass all traffic lights
and arrive in Xdest at the earliest possible time.
It is allowed to brake and/or stop at any point during the trip, including (of course) for red traffic
lights. However, it may be more efficient to figure out some way in which you can cycle past the traffic
lights while they are green.
Input
The input for each test case consists of the following items:
• A line containing a floating point number Xdest and an integer L.
Xdest is the total distance to travel in meters (1 ≤ Xdest ≤ 10000);
L is the number of traffic lights to pass (0 ≤ L ≤ 10).
• L lines describing the traffic lights, listed in order of increasing X position.
Each of these lines contains 3 floating point numbers:
– Xi
, the position of the traffic light in meters from the start (0 < Xi < Xdest);
– Ri
, the duration of each red-light period of this traffic light in seconds (10 ≤ Ri ≤ 500);
– Gi
, the duration of each green-light period of this traffic light in seconds (10 ≤ Gi ≤ 500).
All traffic lights turn red at time T = 0.
Traffic light i turns green for the first time at T = Ri
.
There is never more than one traffic light in the same position.
Output
For each test case, write one line of output containing a floating point number: the earliest time at
which the cyclist can reach the destination.
The answer should be rounded to 3 digits after the decimal point.
The test cases will be such that very small inaccuracies will not cause errors in the final answer
after rounding.
Sample Input
410.0 2
200.0 15.0 15.0
225.0 31.0 10.0
410.0 2
200.0 15.0 15.0
225.0 35.1 15.0
410.0 2
200.0 15.0 15.0
225.0 45.0 10.0
Sample Output
41.497
52.623
57.213

Question3(题解:http://blog.csdn.net/ganjingxian/article/details/77802140

Description

地主某君有一块由2×n个栅格组成的土地,有k个儿子,现在地主快要终老了,要把这些土地分给这些儿子。分给每个儿子的土地最小的单位是一个栅格,同时,分给同一个儿子的土地要求要相邻连续的。地主觉得分给某个儿子的土地面积至少有一个栅格,但是具体多少可以随意。请问,聪明的你,能够算出地主一共有多少种分土地的方法吗?也就是说要求把2*n的栅格分成k个连通区域,每个区域至少有一个栅格。

Input

包含两个正整数n和k。

Output

包含一个整数,为可以分土地的方法数模100000007。

Sample Input

5 2

Sample Output

45

Hint

数据保证2×n>=k。
1<=n<=1000
1<=k<=2*n

Question 4

Description

「寻找希望…为了找出希望…
那才是真正的希望…
只要拥有这样的希望,
不管陷入怎样的困境,我们都能继续前行…」
“这是 发生在互相残杀的学园生活之前的故事 。也或许根本就是某个平行世界的故事。
“黑幕站在大门口,静静地审视着希望之峰学园 。旁边站着的是一只 长得像玩偶的熊, 身体一半是黑色一半是白。 不知道是否对接下来将要引起的绝望而感到兴奋,黑幕的嘴角不易察觉地微微上扬。 而身旁 的黑白熊则 ‘唔噗噗噗 ’地意味不明地笑着。
“为了 计划的顺利实施,黑幕需要在学园内装上能监视到所有地方的摄像头。 学园 里一共 有n个房间,有一些房间通过走廊相连。出于特殊的原因,学园只修建了保证所有房间都能互相到达的前提下的最少的走廊。一个房间里的摄像头可以监视到这个房间以及这个房间直接通过走廊相连的所有房间。
“配置摄像头也不是一件简单的事情,所以黑幕决定安装尽量少摄像头。 同时黑幕也想到了一个超高校级的问题: 在安装最少的摄像头前提下,一共有多少种安装的方案? 两个方案不同当且仅存在一个房间在种方案中安装了摄像头,而在另一种方案中没有安装。
“答案 我已经计算出来了哦,你能吗? ”Alter Ego对着屏幕前的人,微笑着说道。

Input

输入 第一行含有一个整数n,代表学园里房间的数量。
接下来n−1行,每行描述一条走廊。每行含有 两个数,代表这条走廊连接的两个房间。

Output

输出 一共两行 。
第一行输出 一个整数,代表需要安装的最少摄像头的数目。
第二行输出一个整数,代表安装的方案数。由于答案可能很大,故输出答案对1,000,000,007取模的结果。

Sample Input

7

2 1

3 1

4 2

5 1

6 2

7 6

Sample Output

3

4

Data Constraint

这里写图片描述

Hint

这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值