日期:2014-05-20  浏览次数:20684 次

大家帮忙看看这程序题什么意思,英文不好,看不懂!
2. MultiplesWithLimit
Problem Statement
Your task is to find the minimal positive integer x such that:  
1. x is an integer multiple of N.
2. The decimal representation of x doesn't contain any forbidden digits.
You will be given the forbidden digits as a int[] forbiddenDigits.  
If there is no solution, you should return the String "IMPOSSIBLE" (quotes for clarity).  
If there is a solution and its number of digits is strictly less than 9, you should return a String
containing the integer x in base 10, with no leading zeros.
Otherwise, you should return a String of the form "abc...def(g digits)" (quotes for clarity). In the
return value, abc are the first three digits of the smallest valid integer x, def are its last three
digits, and g is the number of digits in x (a base-10 integer with no leading zeros).
Definition
Class: MultiplesWithLimit
Method: minMultiples
Parameters: int, int[]
Returns: String
Method signature: String minMultiples(int N, int[] forbiddenDigits)
(be sure your method is public)
Constraints
- N will be between 1 and 10000, inclusive.
- forbiddenDigits will contain between 0 and 10 elements, inclusive.  
- Each element of forbiddenDigits will be between 0 and 9, inclusive.  
- The elements of forbiddenDigits will be pairwise distinct.  
Examples  
0) 8
{2,3,4,5,6,7,8,9}
Returns: "1000"
The smallest positive multiple of 8 that only contains digits 0 and 1 is 1000.
1) 9
{1,3,4,5,6,7,8,9}
Returns: "222...222(9 digits)"
2) 524
Algorithm Tests
3
{5,2,4}
Returns: "3668"
3) 10000
{0}
Returns: "IMPOSSIBLE"
4) 1
{0,1,2,3,4,5,6,7,8,9}
Returns: "IMPOSSIBLE"

------解决方案--------------------
问题描述
你的任务是查找一个这样的(满足一下条件的)最小的正整数x:
1.x 是一个整数N的倍数。
2.x 的数字串中不能包含禁用的数字。
禁用的数字以int[]forbiddenDigits参数传给你。
如果没有答案,你应该返回字符串"IMPOSSIBLE"(不包含引号,引号只是为了清楚)。
如果有答案,并且这个答案的位数少于9,你应该返回这个数的10进制字符串,不以0开头。
否则(有答案,并且答案的位数大于等于9),你应该返回这样的形式"abc...def(g digits)","abc" 是答案x的前三位数字,
"def"是答案x的最后三个数字,"g"是答案x的位数(十进制,不以0开头)。
定义
Class: MultiplesWithLimit
Method: minMultiples
Parameters: int, int[]
Returns: String
Method signature: String minMultiples(int N, int[] forbiddenDigits)
(确保你的方法是public)
限制条件(校验内容)
- N 在1到10000之间,包含边界值(1,10000)。
- 禁用数字包含0到10个元素,包含边界值(0,10)。
- 每一个禁用数字是0到9之间的数,包含边界值(0,9)。
- 禁用数字两两都不相同。
例子:……