设为首页 加入收藏

TOP

Java程序练习-Mobile Number
2014-11-24 12:13:54 来源: 作者: 【 】 浏览:0
Tags:Java 程序 练习 -Mobile Number

We call the number of different digitals at the same position of two phone numbers: 'difference'.


Number 1: 1 3 6 0 0 0 0 0 0 0 0
Number 2: 1 4 6 0 0 0 0 0 0 0 1
Difference: 0+1+0+0+0+0+0+0+0+0+1 = 2


Search the booklet and find out the numbers between the difference A and B to the given correct phone numbers.


输入
The first line of the input is two integers: n and m. n is the numbers counted on the booklet, while m is the given correct phone numbers (0 < n ≤ 1000, 0 < m ≤ 200).


Then follow n lines. On each line is a phone number in the booklet which are all distinct. Then m lines, on each line there is a correct given phone number and difference A and B (0 ≤ A, B ≤ 11). Note: all the input phone numbers will be valid phone number: 11 digitals per number.


输出
For each given correct phone number, print "Number *:"(* should be replaced by the order this number shows up).


Then print all the within-difference number in the booklet. Ordered as the same as in the booklet.


Then follows a line printed "Total: *", * should be replaced by the total number of the within-difference numbers.


Then print a blank line after each given correct phone number.


样例输入
4 2
13600000000
13500000001
13700000001
15500000000
13600000000 1 1
13700000001 1 2
样例输出
Number 1:
Total: 0


Number 2:
13600000000
13500000001
Total: 2


参考代码


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Java程序练习-DNA sorting 下一篇Java程序练习-Ugly Numbers

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·Redis 分布式锁全解 (2025-12-25 17:19:51)
·SpringBoot 整合 Red (2025-12-25 17:19:48)
·MongoDB 索引 - 菜鸟 (2025-12-25 17:19:45)
·What Is Linux (2025-12-25 16:57:17)
·Linux小白必备:超全 (2025-12-25 16:57:14)