Problem 2874 --1.3.4 Prime Cryptarithm

2874: 1.3.4 Prime Cryptarithm

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $2$ 正确数量 $1$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 usaco 递归

The following cryptarithm is a multiplication problem that can be solved by substituting digits from a specified set of N digits into the positions marked with *. If the set of prime digits {2,3,5,7} is selected, the cryptarithm is called a PRIME CRYPTARITHM.

      * * *
   x    * *
    -------
      * * *
    * * *
    -------
    * * * *
Digits can appear only in places marked by `*'. Of course, leading zeroes are not allowed.

Write a program that will find all solutions to the cryptarithm above for any subset of digits from the set {1,2,3,4,5,6,7,8,9}. 

Line 1: N, the number of digits that will be used
Line 2: N space separated digits with which to solve the cryptarithm 

A single line with the total number of unique solutions. Here is the single solution for the sample input:

      2 2 2
    x   2 2
     ------
      4 4 4
    4 4 4
  ---------
    4 8 8 4
5
2 3 4 6 8
1

推荐代码 查看2874 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$0 $ms] 计爱玲 446183 2019-06-29 22:12:06
内存最少[$2024 $KB] 计爱玲 446183 2019-06-29 22:12:06
第一AC 计爱玲 446183 2019-06-29 22:12:06
第一挑战 计爱玲 446178 2019-06-29 21:42:08

赛题来源/所属竞赛 usaco training usaco Training

竞赛编号 竞赛名称 竞赛时间 访问比赛