来源:http://noi.openjudge.cn/ch0207/413/

Calling Extraterrestrial Intelligence Again

总时间限制:

1000ms

内存限制:

65536kB

描述

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 x 73 pixels. Since both 23 and 73 are prime numbers, 23 x 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 indicates 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.

样例输入

5 1 2
99999 999 999
1680 5 16
1970 1 1
2002 4 11
0 0 0

样例输出

2 2
313 313
23 73
43 43
37 53

翻译:

‎1974年11月16日星期六下午,通过波多黎各的阿雷西博射电望远镜向外星智能发出了人类的信息。该消息由 1679 位组成,旨在转换为具有 23 x 73 像素的矩形图片。由于 23 和 73 都是质数,因此 23 x 73 是平移矩形图片的唯一可能大小,其每个边缘的长度都超过 1 个像素。当然,不能保证接收者会尝试将消息转换为矩形图片。即使他们这样做,他们也可能会错误地将像素放入矩形中。阿雷西博信息的发送者是乐观的。‎

‎我们正在计划一个类似的项目。您在项目中的任务是找到翻译后的矩形图片的最合适的宽度和高度。"最合适"一词的定义如下。给出大于 4 的整数 m。还给出了小于或等于 1 的正分数 a/b。图片的面积不应大于 m。翻译图片的宽度和高度都应该是素数。宽度与高度的比率不应小于 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 和分母 b,按此顺序排列。您可以假设 4 < m < = 100000,1 < = a < = b < = 1000。‎

输出

‎输出是一对正整数序列。第 i 个输出对对应于第 i 个输入三元组。每个输出对的整数是上述宽度 p 和高度 q,按此顺序排列。‎

‎每条输出线包含一对。空格字符作为分隔符放在整数之间。输出中不应显示任何其他字符。‎

413:Calling Extraterrestrial Intelligence Again(翻译 )相关推荐

  1. Calling Extraterrestrial Intelligence Again

    Calling Extraterrestrial Intelligence Again Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 6 ...

  2. HDU 1239 Calling Extraterrestrial Intelligence Again

    题目 http://acm.hdu.edu.cn/showproblem.php?pid=1239 Problem Description A message from humans to extra ...

  3. 08:Calling Extraterrestrial Intelligence AgainMOOC程序设计算法基础期末第八题

    问题表述: A message from humans to extraterrestrial intelligence was sent through the Arecibo radio tele ...

  4. 【HDU/POJ/ZOJ】Calling Extraterrestrial Intelligence Again (素数打表模板)

    http://poj.org/problem?id=1411  POJ http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=168 ...

  5. 【HDOJ】1239 Calling Extraterrestrial Intelligence Again

    这题wa了很多词,题目本身很简单,把a/b搞反了,半天才检查出来. 1 #include <stdio.h> 2 #include <string.h> 3 #include ...

  6. 【筛法求素数】HDU-1239 Calling Extraterrestrial Intelligence Again

    注解 1.首先用筛法求100000以内的素数,并找到其个数. 2.在所有找到的素数中,遍历找一个素数对,满足: (1)二者相乘小于等于m: (2)二者相乘是所有满足条件的素数对中的最大的: (3)二者 ...

  7. POJ 1411 Calling Extraterrestrial Intelligence Again G++ 易超时

    #include <iostream> #include <cstdio> using namespace std; //英语 抄博友程序 博友程序更快 易超时 int pri ...

  8. 大学英语(第六册)复习(原文及全文翻译)——Unit 3 - The Quest For Extraterrestrial Intelligence(搜寻外星人)

    Unit 3 - The Quest For Extraterrestrial Intelligence Are we humans alone in the universe? Or is ther ...

  9. CodeForces刷题C语言:What is for dinner?、Reconnaissance 2、Shell Game、Extra-terrestrial Intelligence、Extra

    记录洛谷刷题c语言QAQ 一.What is for dinner? 题面翻译 题面描述 鲨鱼有 n n n 颗牙齿,分别分布于 m m m 行上,第 i i i 颗牙齿有一个初始活力值 c i c_ ...

最新文章

  1. PowerShell让系统可以执行.ps1文件
  2. Spring Cache抽象-基于XML的配置声明(基于ConcurrentMap的配置)
  3. [云炬创业学笔记]第一章创业是什么测试8
  4. 进销存中多计量单位解决方法
  5. ios 高德获取定位_解决ios11不支持高德地图API定位功能的方法
  6. 键值数据库LevelDB的优缺点及性能分析
  7. jtessboxeditorfx 界面显示不出来_华为Mate40 Pro开箱简评,有点不开心
  8. linux php sphinx拓展,Centos安装php扩展sphinx
  9. python简单代码-手把手教你用Python创建简单的神经网络(附代码)
  10. linux 列出指定目录下所有文件的 列表集合
  11. 邮箱怎么打开smtp服务器端口号,什么是SMTP协议?SMTP端口号是多少?什么是SMTP服务器?免费smtp服务器?...
  12. oceanbase ODC和Obclient连接mysql类型的ob库
  13. nexus3.x批量上传jar包
  14. Oracle 、SqlServer 根据日期逐日、逐月递增累加、逐行累加
  15. keil5 报错no target connected
  16. 【精品】IntelliJ 文件模板 创建 通用Controller
  17. 【案例】天津滨海农商行:基于大数据风控的移动互联网个人快贷系统——滨e贷
  18. 三星Galaxy S5高配版大提速
  19. 群体进化,群体结构分析之STRUCTURE分析三款软件比较
  20. 数据库的原理,一篇文章搞定(一)

热门文章

  1. 读入2个整数A和B,然后输出它们的和
  2. 教你怎么去辨别电脑配置的好或坏
  3. 2021年上海互联网公司非官方排名
  4. python3 判断字符串是否包含中英文和数字
  5. javascript中substring,substr和slice对比
  6. GOE:Nintendo Switch™ 对战忍者口香糖动作游戏 『Ninjala』决定于2020年6月25日发售
  7. 看张亚飞《.Net for Flash FMS》的笔记
  8. IT女孩又来总结了-2015年终总结
  9. 24、Java——银行存款取款系统(对象+集合)
  10. 实现Gmail邮箱翻转效果之开篇