HDOJ 1406 完数
来源:互联网 发布:淘宝游戏王正版 编辑:程序博客网 时间:2024/06/06 06:58
HDACM 1406
直接打表解决
import java.util.Scanner;public class Main{ public static void main(String[] args) { boolean finish[] = new boolean[10000]; for (int i = 1; i < finish.length; i++) { int sum = 1; for (int j = 2; j*j <= i; j++) { if (i%j==0) { sum += j+i/j; } } if (sum == i) { finish[i] = true; } } Scanner sc = new Scanner(System.in); int n = sc.nextInt(); while (n-->0) { int a = sc.nextInt(); int b = sc.nextInt(); int count = 0; for (int i = a>b?b:a; i <= (a>b?a:b); i++) { if (finish[i]) { count++; } } System.out.println(count); } sc.close(); }}
阅读全文
0 0
- hdoj 1406 完数
- hdoj 1406 完数
- HDOJ 1406 完数
- HDOJ 1406 完数
- Hdoj 1406 完数
- hdoj.1406 完数 20140825
- HDOJ(HDU) 1406 完数
- HDOJ 1406 完数
- HDOJ 1406 完数(打表,附讨论区出现的史上最牛逼打表,0ms)
- hdoj 2084(数塔)
- HDOJ 2084 数塔
- hdoj 2084 数塔
- hdoj 2072 单词数
- HDOJ 2084 数塔
- HDOJ 1261 字串数
- HDOJ 2010 水仙花数
- hdoj 2072 单词数
- HDOJ 2084 数塔
- SSM-----springMVC No mapping found for HTTP request with URI的问题
- mmap内存映射
- WMware中linux系统无wlan0网卡的解决方法
- 文章标题
- 百度地图接口
- HDOJ 1406 完数
- transform、transition、animation区别
- JSP中请求转发何请求重定向的区别
- 1!+2!+...+n!
- HTML CSS
- 写golang restful接口时遇到的一个坑
- SSM---访问后台提示HTTP Status 404
- 关于Server Tomcat v9.0 Server at localhost failed to start.的分析
- Exception in thread "main" org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qua