| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 572 人关注过本帖
标题:Unfriendly Numbers 网上看到的 大家做做看
只看楼主 加入收藏
silentfrog
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2011-12-24
结帖率:100%
收藏
 问题点数:0 回复次数:0 
Unfriendly Numbers 网上看到的 大家做做看
There is one friendly number and N unfriendly numbers. We want to find how many numbers are there which exactly divide the friendly number, but does not divide any of the unfriendly numbers.
Input Format:
The first line of input contains two numbers N and K seperated by spaces. N is the number of unfriendly numbers, K is the friendly number.
The second line of input contains N space separated unfriendly numbers.
 
Output Format:
Output the answer in a single line.
 
Constraints:
1 <= N <= 10^6
1 <= K <= 10^13
1 <= unfriendly numbers <= 10^18
 
Sample Input:
8 16
2 5 7 4 3 8 3 18
 
Sample Output:
1
 
Explanation :
Divisors of the given friendly number 16, are { 1, 2, 4, 8, 16 } and the unfriendly numbers are {2, 5, 7, 4, 3, 8, 3, 18}. Now 1 divides all unfriendly numbers, 2 divide 2, 4 divide 4, 8 divide 8 but 16 divides none of them. So only one number exists which divide the friendly number but does not divide any of the unfriendly numbers. So the answer is 1
搜索更多相关主题的帖子: single friendly exactly numbers 
2012-04-15 21:37
快速回复:Unfriendly Numbers 网上看到的 大家做做看
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.030344 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved