projecteuler Smallest multiple
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
译:
2520是能被从1到10整除的最小整数,求出能被从1到20整除的最小数。
=======================================
第一次code:
public class Main { public static void main (String[] args) { System.out.println(sum(600000000)); } public static int sum(int num) { int c=0; for(int i=1;i<num;i++) { if(i % 1== 0 && i % 2 ==0 && i % 3== 0 && i % 4 ==0 && i % 5== 0 && i % 6 ==0 && i % 7== 0 && i % 8 ==0 && i % 9== 0 && i % 10 ==0 && i % 11== 0 && i % 12 ==0 && i % 13== 0 && i % 14 ==0 && i % 15== 0 && i % 16 ==0 && i % 17== 0 && i % 18 ==0 && i % 19== 0 && i % 20 ==0 ) { c=i; break; } else { c=111; } } return c; } }
projecteuler Smallest multiple的更多相关文章
- Smallest multiple
problem 5:Smallest multiple 题意:求最小的正数,使得其可以被1-20整除 代码如下: #ifndef PRO5_H_INCLUDED #define PRO5_H_INCL ...
- (Problem 5)Smallest multiple
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any rema ...
- Problem 5: Smallest multiple
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any rema ...
- Python练习题 033:Project Euler 005:最小公倍数
本题来自 Project Euler 第5题:https://projecteuler.net/problem=5 # Project Euler: Problem 5: Smallest multi ...
- Types of compression algorithms
http://www.html5rocks.com/en/tutorials/speed/img-compression/ Types of compression algorithms There ...
- PE 001~010
题意: 001(Multiples of 3 and 5):对小于1000的被3或5整除的数字求和. 002(Even Fibonacci numbers):斐波那契数列中小于等于4 000 000的 ...
- Alignment And Compiler Error C2719 字节对齐和编译错误C2719
Compiler Error C2719 'parameter': formal parameter with __declspec(align('#')) won't be aligned The ...
- Problem5-Project Euler
Smallest multiple 2520 is the smallest number that can be divided by each of the numbers from 1 to ...
- Project Euler Problem5
Smallest multiple Problem 5 2520 is the smallest number that can be divided by each of the numbers f ...
随机推荐
- powerdesigner中将表的name在生成建表sql时生成注释
1.为powerdesigner的表设置注释方法: powerdesigner默认没有注释: 设置方法: 选择那个表 右键- >Properties- >Columns- >Cust ...
- MSSQL死锁产生原因及解决方法
一. 什么是死锁 死锁是指两个或两个以上的进程在执行过程中,因争夺资源而造成的一种互相等待的现象,若无外力作用,它们都将无法推进下去.此时称系统处于死锁状态或系统产生了死锁,这些永远在互相等的进 ...
- 初始化ArrayList的两种方法
方式一: ArrayList<String> list = new ArrayList<String>(); String str01 = String("str ...
- ckfinder的配置使用
1.单纯的上传图片和预览图片 修改configasp中CheckAuthentication = true; 否则的话会报没有权限或修改配置错误 此时如果可以查看的话,单击图片应该是放大并且预览图片 ...
- linux驱动学习之Input输入子系统
以前,看过国嵌关于input子系统的视频课程,说实话,我看完后脑子里很乱,给我的印象好像是input子系统驱动是一个全新的驱动架构,疑惑相当多.前几天在网上,看到有很多人介绍韦东山老师的linux驱动 ...
- Java String 的实例(02)
1.初始化数组以及数组的拷贝 int[] a={1,2,3,4}; //System.out.println(Arrays.toString(a)); a=new int[ ...
- zabbix通过sendmail进行邮箱警报
安装sendmail /usr/lib/zabbix/alertscripts/SendEmail.sh #!/bin/bash to_email_address="$1" # 收 ...
- JDK6的switch支持不是很好
在switch中只支持int或者枚举型值: 不支持其他类型,如String,会报错 Cannot switch on a value of type String for source level b ...
- 技术转载:Jni学习四:如何编写jni方法
转载:http://blog.chinaunix.net/u1/38994/showart_1099528.html 一.概述: 在这篇文章中将会简单介绍如何编制一些简单的JNI 方法.我们都知道JN ...
- 带你快速了解CODESOFT 2015
CODESOFT是知名的条码标签设计打印软件,现在又推出了最新版CODESOFT 2015,其新功能.大改进让人为之一振.下面跟随小编的脚步,走进CODESOFT 2015,看一看CODESOFT 2 ...