| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1643 人关注过本帖, 1 人收藏
标题:K-based numbers
只看楼主 加入收藏
三少爷
Rank: 1
等 级:新手上路
帖 子:192
专家分:0
注 册:2004-4-29
收藏(1)
 问题点数:0 回复次数:5 
K-based numbers
Time Limit: 1.0 second Memory Limit: 1 000 КБ

Let's consider K-based numbers, containing exactly N digits. We define a number to be valid if its K-based notation doesn't contain two successful zeroes.

Example: 1010230 is a valid 7-digit number 1000198 is not a valid number 0001235 is not a 7-digit number, it is a 4-digit number.

Given two numbers N and K, you are to calculate an amount of valid K based numbers, contaning N digits.

You may assume that 2 <= K <= 10; 2 <= N; 4 <= N+K <= 18.

Input two decimal numbers N and K

Output The result in decimal notation.

Sample Input 2 10

Sample Output 90

搜索更多相关主题的帖子: numbers valid Limit Let two 
2004-05-26 21:28
三少爷
Rank: 1
等 级:新手上路
帖 子:192
专家分:0
注 册:2004-4-29
收藏
得分:0 

我在网上找的,懂的就一起来讨论讨论并做做吧

这里人多相信高手也不少


2004-05-26 21:29
三少爷
Rank: 1
等 级:新手上路
帖 子:192
专家分:0
注 册:2004-4-29
收藏
得分:0 

哦这题没什么意思知道递推公式就简单了还是做这道吧

A stone game Time Limit: 1.0 second Memory Limit: 1 000 КБ

Two Nikifors play a funny game. There is a heap of N stones in front of them. Both Nikifors in turns take some stones from the heap. One may take any number of stones with the only condition that this number is a nonnegative integer power of 2 (e.g. 1, 2, 4, 8 etc.). Nikifor who takes the last stone wins. You are to write a program that determines winner assuming each Nikifor does its best.

Input

An input contains the only positive integer number N (condition N <= 10250 holds).

Output

The first line of an output file should contain 1 in the case the first Nikifor wins and 2 in case the second one does. If the first Nikifor wins the second line should contain the minimal number of stones he should take at the first move in order to guarantee his victory.

Sample Input

8

Sample Output

12

2004-05-26 22:25
三少爷
Rank: 1
等 级:新手上路
帖 子:192
专家分:0
注 册:2004-4-29
收藏
得分:0 

1,2,3的我想很多人都玩过一个类似的游戏抢30

但是1,2,4,8呢?


2004-05-26 22:26
kai
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:52
帖 子:3450
专家分:59
注 册:2004-4-25
收藏
得分:0 
什么乱七八糟的,没明白你想干什么。

自由,民主,平等,博爱,进步.
中华民国,我的祖国,中华民国万岁!中华民国加油!
本人自愿加入中国国民党,为人的自由性,独立性和平等性而奋斗!
2004-05-26 22:34
空前
Rank: 1
等 级:新手上路
帖 子:1146
专家分:0
注 册:2004-5-11
收藏
得分:0 

看不懂


2004-05-30 18:46
快速回复:K-based numbers
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014665 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved