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的更多相关文章

  1. Smallest multiple

    problem 5:Smallest multiple 题意:求最小的正数,使得其可以被1-20整除 代码如下: #ifndef PRO5_H_INCLUDED #define PRO5_H_INCL ...

  2. (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 ...

  3. 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 ...

  4. Python练习题 033:Project Euler 005:最小公倍数

    本题来自 Project Euler 第5题:https://projecteuler.net/problem=5 # Project Euler: Problem 5: Smallest multi ...

  5. Types of compression algorithms

    http://www.html5rocks.com/en/tutorials/speed/img-compression/ Types of compression algorithms There ...

  6. PE 001~010

    题意: 001(Multiples of 3 and 5):对小于1000的被3或5整除的数字求和. 002(Even Fibonacci numbers):斐波那契数列中小于等于4 000 000的 ...

  7. Alignment And Compiler Error C2719 字节对齐和编译错误C2719

    Compiler Error C2719 'parameter': formal parameter with __declspec(align('#')) won't be aligned The ...

  8. Problem5-Project Euler

    Smallest multiple   2520 is the smallest number that can be divided by each of the numbers from 1 to ...

  9. Project Euler Problem5

    Smallest multiple Problem 5 2520 is the smallest number that can be divided by each of the numbers f ...

随机推荐

  1. bootstrap-导航、选项卡

    导航: <!-- nav 导航的基础样式 --> <div class="container"> <div class="row" ...

  2. c#生成缩略图

    publicstaticvoidGenThumbnail(Image imageFrom,stringpathImageTo,intwidth,intheight)         {         ...

  3. java小程序 质数

    package com.test; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; im ...

  4. sikuli实例

    代码: package selenium.sikuli; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; im ...

  5. java中json包的使用以及字符串,map,list,自定义对象之间的相互转换

    做一个map和字符串的转换,需要导入这些jar包,这是最基本的一些jar包. 经过多方尝试得出结论入下: 首先导入基本包:json-lib-2.2.3-jdk15.jar 如果没有这个jar包,程序是 ...

  6. http.StripPrefix 的参数含义

    看下面两行代码: http.Handle("/file/", http.StripPrefix("/file", http.FileServer(http.Di ...

  7. SQLSERVER:计算数据库中各个表的数据量和每行记录所占用空间

    转:http://www.cnblogs.com/lyhabc/p/3828496.html CREATE TABLE #tablespaceinfo ( nameinfo ) , rowsinfo ...

  8. oracle rac 日志体系结构!

    告警日志集群节点集群件告警日志:$GRID_HOME/log/<hostname>/alert<hostname>.log数据库实例的告警日志:$DIAG_DESTINATIO ...

  9. HTTP与HttpServlet

    (1).HTTP协议 Web浏览器和服务器通过HTTP协议在Internet上发送和接收消息.HTTP是一种基于请求/响应模式的协议.客户端发送一个请求,服务器端返回对该请求响应. . (2).HTT ...

  10. junit适配器模式应用

    适配器模式 定义: 将一个类的接口转换成客户希望的另外一个接口.Adapter模式使得原本由于接口不兼容而不能一起工作的那些类可以一起工作: 构成: 目标抽象角色(Target):定义客户要用的特定领 ...