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

建议使用的浏览器:

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

1608:Banal Tickets

题目描述
Peter is fond of number theory. That's why he is looking for interesting bus tickets. Ticket with the number of length 2N is called interesting if the product of the first N digits of its number is equal to the product of the last N digits. Other tickets are called banal.
Peter has found a used ticket in his pocket. Unfortunately the ticket was punched, so Peter cannot recognize some digits. He wonders whether this ticket was an interesting one. Moreover he wants to know how many different interesting and banal tickets could be punched to get this one.
Help Peter to find answers to his questions.
输入解释
The first line of the input file contains an integer N(1 <= N<=18). The next line contains a string representing the ticket number. If some digit is punched out it is denoted by "?" otherwise it is denoted by itself.
输出解释
On the first line of the output file print the number of interesting tickets. On the second line print the number of banal tickets.
输入样例
2 
2??3
输出样例
4 
96 

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

源链接: POJ-1608

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

共提交 0

通过率 --%
时间上限 内存上限
5000 32000