编程介的小学生 2019-09-14 02:42 采纳率: 20.5%
浏览 76

Vivian's Problem 的具体的实现

Description

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

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.
Output

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.
Sample Input

1
2
3
2 3 4
Sample Output

NO
2

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
    • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
    • ¥15 绘制多分类任务的roc曲线时只画出了一类的roc,其它的auc显示为nan
    • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
    • ¥20 腾讯企业邮箱邮件可以恢复么
    • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
    • ¥15 错误 LNK2001 无法解析的外部符号
    • ¥50 安装pyaudiokits失败
    • ¥15 计组这些题应该咋做呀
    • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?