为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

大家帮忙看看这程序题什么意思英文不好,看不懂该如何解决

2017-09-20 4页 doc 16KB 21阅读

用户头像

is_682974

暂无简介

举报
大家帮忙看看这程序题什么意思英文不好,看不懂该如何解决大家帮忙看看这程序题什么意思英文不好,看不懂该如何解决 大家帮忙看看这程序题什么意思,英文不好,看不懂~ 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 digit...
大家帮忙看看这程序题什么意思英文不好,看不懂该如何解决
大家帮忙看看这程序题什么意思英文不好,看不懂该如何解决 大家帮忙看看这程序题什么意思,英文不好,看不懂~ 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)。 - 禁用数字两两都不相同。 例子:……
/
本文档为【大家帮忙看看这程序题什么意思英文不好,看不懂该如何解决】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索