编程介的小学生 2019-09-09 19:12 采纳率: 20.5%
浏览 118

Banal Tickets 怎么写代码,不会回答的请绕道

Description

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

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

On the first line of the output file print the number of interesting tickets. On the second line print the number of banal tickets.
Sample Input

2
2??3
Sample Output

4
96

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 求三轴之间相互配合画圆以及直线的算法
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 自己瞎改改,结果现在又运行不了了
    • ¥15 链式存储应该如何解决
    • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站