当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1777:Vivian's Problem

题目描述
The desire to explore the unknown has been a driving force in human history since the dawn of time. From the earliest documented accounts, ancient civilizations had explored the earth by sailing around. Early adventurers were motivated by religious beliefs, the desire conquest, the need to establish trade routes, and hunger for gold.
You never know what will happen before the exploration. Neither does Bruce Lee. Someday, Mr.Lee entered a desolate tropical rainforest. And after several days' exploring, he came in front of a cave with something blinking in it. A beautiful girl named Vivian came out just before he tried to go into the cave. And Vivian told Mr. Lee that he must answer some questions before he entered the cave. As the best friend of Mr. Lee, you should help him to work it out.
You will get k positive integers p1, p2 ... pi ... pk (1 <= i <= k) from Vivian. From these numbers, you can calculate N, N=Π1<=i<=kpiei (0 <= ei <= 10, Σ1<=i<=kei>=1, 1 <= i <= k); you may decide the integers eis as you wish. From one N, you can calculate corresponding M, which equals to the sum of all divisors of N. Now, you should tell Vivian whether or not there is an M which is the power of 2 (1,2, 4, 8, and 16 … so on). If there's no N can make M equal to the power of 2, tell Vivian "NO". If M equals to some 2x, then show her the exponent (x). And if there are several x, only show her the largest one.
输入解释
Input contains several testcases. For each testcase, the first line contains only one integer k (0 < k <= 100), representing the number of positive integers. Then there are k positive integers p1, p2 ... pi ... pk (1 < pi < 231, 1 <= i <= k) in the second line, representing the given numbers.
Input is terminated by end of file.
输出解释
For each testcase, you should output your result in a single line. If you can find N from the given numbers, output the largest exponent. Otherwise, output "NO". Extra spaces are not allowed.
输入样例
1
2
3
2 3 4
输出样例
NO
2

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Asia Guangzhou 2003

源链接: POJ-1777

最后修改于 2020-10-29T06:13:52+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 30000