| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1594 人关注过本帖
标题:[讨论]第一十九期编程题目
取消只看楼主 加入收藏
leeco
Rank: 4
等 级:贵宾
威 望:10
帖 子:1029
专家分:177
注 册:2007-5-10
结帖率:50%
收藏
 问题点数:0 回复次数:0 
[讨论]第一十九期编程题目

既然出简单出难都没有人做就出难点的吧,这是最近TJU比赛的题目中过的人数最多的四道中过的人数最少的两道,注意我就是这个意思,没有表达错误,不过毫不客气的说对初学者仍然颇有难度。
这是当时比赛的情况,下面两题分别为题目F和题目H,可以看到这两题是被提交次数最多的两题,但通过人数确不是最多,而通过率几乎是最低的两道。
http://acm.tju.edu.cn/toj/contest/stat71.html


http://acm.tju.edu.cn/toj/showp2845.html

Factorial
--------------------------------------------------------------------------------
Time Limit: 1.0 Seconds Memory Limit: 65536K
Total Runs: 53 Accepted Runs: 25

--------------------------------------------------------------------------------


Robby is a clever boy, he can do multiplication very quickly, even in base-2 (binary system), base-16 (hexadecimal system) or base-100000.
Now he wants to challenge your computer, the task is quite simple: Given a positive integer N, if we express the N ! (N ! = N * (N - 1) * (N - 2) * ... * 2 * 1) in base-B, how many ZEROs there will be at the end of the number. Can you make a wonderful program to beat him?


Input
Each test case contain one line with two numbers N and B. (1 ≤ N ≤ 10^9, 2 ≤ B ≤ 100000)
The input is terminated with N = B = 0.

Output
Output one line for each test case, indicating the number of ZEROs.
Sample Input
7 10
7 10000
7 2
0 0

Sample Output
1
0
4


Hint
7! = (5040)10, so there will be one zero at the end in base-10. But in base-10000, the number (5040)10 can be expressed in one non-zero digit, so the second answer is 0. In base-2, 7! = (1001110110000)2, so the third answer is 4.
Problem Setter: RoBa

翻译:给定N 和 B两个数. (其中1 ≤ N ≤ 10^9, 2 ≤ B ≤ 100000)

计算N阶乘在B进制下的尾数0的个数。(给定的N的形式总是视为10进制意义下的)
例如 5 10
5!=5*4*3*2*1=120在十进制下尾数0的个数为1
再如 7 2
7!=5040(十进制)=1001110110000(二进制),所以在2进制意义下7!尾数0的个数为4


http://acm.tju.edu.cn/toj/showp2847.html

How Far Can We Go
--------------------------------------------------------------------------------
Time Limit: 10.0 Seconds Memory Limit: 65536K Special Judge
Total Runs: 61 Accepted Runs: 23

--------------------------------------------------------------------------------


Robby is a bad-tempered child, and he often quarrels or even fights with others. After the quarrelling, he often shouts to his opponent: "Go away from me, as far as possible! I never want to see you again!"
When he calms down, he finds that it is an interesting problem in fact: Given the position of all the cities, what's the maximum distance between any pairs of them?

Input
The first line of each test case contain an integer N (2 ≤ N ≤ 100000), indicating the number of cities. Then N lines followed, each line contains two numbers Xi and Yi, indicating there is a city at (Xi, Yi). (|Xi|, |Yi| ≤ 10^7)
The input is terminated with N = 0.

Output
Output one number in one line for each test case, indicating the maximum distance. Two digits after decimal point are preserved by rounding.
Sample Input
4
0.0 0.0
-1.0 -1.0
0.0 -1.0
-1.0 0.0
0

Sample Output
1.41
Problem Setter: RoBa

Note: Special judge problem, you may get "Wrong Answer" when output in wrong format.

翻译:求给定点集中的最远点对的距离。
例如
4 //表示点集中点的个数
0.0 0.0 //(0.0,0.0)
-1.0 -1.0
0.0 -1.0
-1.0 0.0
其中(0.0,0.0)到(-1.0,-1.0)和(0.0,-1.0)到(-1.0,0.0)的距离均为最远距离"根号2",所以答案是1.41(四舍五入保留2位小数)
提示:最远点对的NlogN算法是首先求出凸包,然后沿着凸包O(N)的寻找所谓“对面点”,取其中距离最大的点对即可。
这题我自己也没做,我没写过凸包算法,手上也没几何库,希望看到解答,顺便让我收了您的凸包代码

[此贴子已经被作者于2007-6-16 0:25:42编辑过]

搜索更多相关主题的帖子: acm contest tju 
2007-06-16 00:23
快速回复:[讨论]第一十九期编程题目
数据加载中...
 
   



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

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