1.27题目翻译

题目链接:https://acs.jxnu.edu.cn/problem/HDU1239

A message from humans to extraterrestrial intelligence was sent through the Arecibo radio telescope in Puerto Rico on the afternoon of Saturday November 16, 1974. The message consisted of 1679 bits and was meant to be translated to a rectangular picture with 23 * 73 pixels. Since both 23 and 73 are prime numbers, 23 * 73 is the unique possible size of the translated rectangular picture each edge of which is longer than 1 pixel. Of course, there was no guarantee that the receivers would try to translate the message to a rectangular picture. Even if they would, they might put the pixels into the rectangle incorrectly. The senders of the Arecibo message were optimistic. 
We are planning a similar project. Your task in the project is to find the most suitable width and height of the translated rectangular picture. The term "most suitable" is defined as follows. An integer m greater than 4 is given. A positive fraction a / b less than or equal to 1 is also given. The area of the picture should not be greater than m. Both of the width and the height of the translated picture should be prime numbers. The ratio of the width to the height should not be less than a / b nor greater than 1. You should maximize the area of the picture under these constraints.

In other words, you will receive an integer m and a fraction a / b. It holds that m > 4 and 0 < a / b < 1. You should find the pair of prime numbers p, q such that pq <= m and a / b <= p / q <= 1, and furthermore, the product pq takes the maximum value among such pairs of two prime numbers. You should report p and q as the "most suitable" width and height of the translated picture.

输入:

The input is a sequence of at most 2000 triplets of positive integers, delimited by a space character in between. Each line contains a single triplet. The sequence is followed by a triplet of zeros, 0 0 0, which indicated the end of the input and should not be treated as data to be processed.

The integers of each input triplet are the integer m, the numerator a, and the denominator b described above, in this order. You may assume 4 < m <= 100000 and 1 <= a <= b <= 1000.

输出:

The output is a sequence of pairs of positive integers. The i-th output pair corresponds to the i-th input triplet. The integers of each output pair are the width p and the height q described above, in this order.

Each output line contains a single pair. A space character is put between the integers as a delimiter. No other characters should appear in the output.

1974年11月16日星期六下午,Arecibo  RicoArecibo无线电望远镜发送了人类对地外智能的信息。该信息由1679个字节组成而且应该被翻译成一个有23*73像素的矩形图片。由于23和73都是质数,所以23*73是每条边翻译后的矩形图像的唯一可能大小,其中的长度超过1个像素。当然,这并不能保证接收者会试图将信息转换成一个矩形的图片。即使他们愿意,他们也可能会把像素放入错误的矩形中。传递Arecibo信息的发件人都是主观的。我们正在计划一个类似的项目。您在这个项目中的任务是找到最合适的宽度和高度的翻译的矩形图片。“最合适”的定义如下,给出了一个大于4的整数m。也给出了一个小于或等于1的正分数a / b。翻译后的图片的宽度和高度都应该是质数。宽度与高度的比值不应小于a/b或大于1。在这些限制条件下,你应该最大化图片的面积。换句话说,你将收到一个整数m和一个分数a/b。它认为m>4和0<a/b<1。你应该找到这一对质数p,q,使pq<=m和a/b<=p/q<=1,并且,乘积pq取这两个质数对中的最大值。你应该把p和q报告为“最大的数” 可翻译的图片的宽度和高度。

输入:

输入是最多2000个正整数三联体的序列,由中间的空格字符分隔。每一行包含一个三重联体。这个序列后面是一个零的三重态, 0 0 0,表示输入的结束,不应被视为要处理的数据。每个输入三元组的整数分别是整数m、分子a和由ab描述的分母b 哦,按这个顺序。您可以假设4<m<=100000和1<=a<=b<=1000。

输出:

输出的是一组正整数对组成的序列。第i个输出对对应于第i个输入三联体。每个输出对的整数是上面描述的宽度p和高度q, 按这个顺序。每个输出线都包含一对。一个空格字符被放在整数之间作为分隔符。输出中不应出现任何其他字符。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值