| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1475 人关注过本帖
标题:上次那个项链问题我找到原题了-----------大家来讨论一下
取消只看楼主 加入收藏
crackerwang
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:833
专家分:0
注 册:2007-2-14
收藏
 问题点数:0 回复次数:4 
上次那个项链问题我找到原题了-----------大家来讨论一下
http://acm.nuaa.edu.cn/acmhome/problemdetail.do?&method=showdetail&id=1110


Latin Stones

时间限制(普通/Java):1000MS/3000MS 运行内存限制:65536KByte
总提交:539 测试通过:75

描述

Ray is very excited today because Jiejie has finally agreed to give Ray some precious Latin Stones. The stones are all the same except for their colors. Every single stone has only one color and there are seven colors in all (Rumba, Samba, ChaChaCha, Jive, Paso Doble, Waltz, and FoxStep).

Since these stones are very precious, Jiejie would like Ray to keep them in an elegant way that obeys the following rules:

1. Stones must be placed in a circle and the length of the circle is n.

2. Adjacent stones cannot have the same color.

This problem really puzzles Ray and he even doubts whether there is a feasible way. So he asks you for help. Given the length of the circle, you should calculate how many different ways the stones can be arranged (ways that can be obtained by rotations should be counted as one). Assume the number of stones of each color is sufficient.

输入

There are multiple test cases. For each test case there is only one line that contains an integer n (less than 100,000) indicating the length of the circle.

输出

For each test case output one integer: the number of ways. Since this number can be really large, just output the reminder after being divided by 2003.

样例输入

2

样例输出

21

题目来源

NUAA

搜索更多相关主题的帖子: 内存 项链 align left 
2007-10-28 09:15
crackerwang
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:833
专家分:0
注 册:2007-2-14
收藏
得分:0 

就是啊....
我也没有做出来....貌似当时他们快的要命..你能找到报告不??


2007-10-28 14:33
crackerwang
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:833
专家分:0
注 册:2007-2-14
收藏
得分:0 
今天正直南京正式比赛...呵呵

2007-10-28 14:33
crackerwang
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:833
专家分:0
注 册:2007-2-14
收藏
得分:0 

这里加了一个约束条件使得有一些置换是不满足的...似乎你是在这里出了问题


2007-10-28 16:51
crackerwang
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:833
专家分:0
注 册:2007-2-14
收藏
得分:0 

我也说不太清楚...因为本身我自己也不会...


2007-10-28 18:39
快速回复:上次那个项链问题我找到原题了-----------大家来讨论一下
数据加载中...
 
   



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

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