Find Digits

Problem Statement

Given a number you have to print how many digits in that number exactly divides that number.

Input format

The first line contains T (number of test cases followed by t lines each containing n

Constraints
1 <=T <= 15
0 < N < 1010

Output Format
Number of digits in that number exactly divides that number.


题解:

 import java.io.*;
import java.util.*; public class Solution { public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
for(int i = 0; i < t; i++){
Long num = in.nextLong();
System.out.println(FindDigits(num));
}
} private static int FindDigits(Long num){ //Write code to solve each of the test over here
Long copy_num = num;
int count = 0;
while(num>0){
Long digit = num%10;
if(digit!=0 && copy_num%digit==0)
count++;
num /= 10;
}
return count;
} }

最新文章

  1. UITableView使用
  2. 读取.properties配置文件
  3. AspJpeg使用 .
  4. 深入webx框架(li)
  5. ASP.NET MVC Json()处理大数据异常解决方法,字符串的长度超过了为 maxJsonLength
  6. Windows Server 2012 R2在桌面上顯示我的電腦等圖示
  7. mysql基本命令(转)
  8. Java 遍历Map时 删除元素
  9. poj3714Raid(平面最近点对)
  10. 如何在腾讯云快速构建一个Wordpress个人站点
  11. DBA_Tablespace表空间的概念和管控(概念)
  12. mysql变量使用总结
  13. UIBezierPathStudyDemo
  14. Metaspace 之二--Java 8的元空间(metaspace)、metaspace监控方法
  15. osg 笔记一 (转)
  16. (二)Java对象与内存控制
  17. hdu4717 The Moving Points 三分法
  18. css字体设置
  19. replication factor
  20. Quartz2.2.x官方教程

热门文章

  1. 浅谈push推送的一点感受
  2. javascript 最佳实践 ( 24 章 )
  3. Hibernate使用注释
  4. Eclipse 内容辅助
  5. bitset在acm中的应用
  6. hdu 1815(二分+2-sat)
  7. MySQL中的聚合函数
  8. WebApi~通过HttpClient来调用Web Api接口
  9. std::vector&lt;std::vector&lt;&gt; &gt;
  10. C++ 基础知识回顾(I/O)