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. Python & MapReduce

    使用Python实现Hadoop MapReduce程序 原文请参考: http://blog.csdn.net/zhaoyl03/article/details/8657031/ 下面只是将mapp ...

  2. ubuntu 修改静态IP和DNS

    1.修改配置文件/etc/network/interfacesroot@ubuntu:~# sudo vi /etc/network/interfaces 添加以下内容:auto eth0       ...

  3. win10安装软件被阻止后

    以管理员身份运行CMD,然后在cmd里执行就可以了.

  4. springmvc 注解 RequestParam/RequestHeader/CookieValue

    RequestParam注解: 示例: @RequestMapping("/testRequestParam") public String testRequestParam(@R ...

  5. delphi中使用spcomm来实现串口通讯(转载)

    http://blog.sina.com.cn/s/blog_7880f98301010pi8.html 转自——飘雪的世界 最近两天一直在研究spcomm控件的使用,之前也是很不太明白,看了很多的例 ...

  6. 【转】SQL Server 查询表的记录数(3种方法,推荐第一种)

    --SQL Server 查询表的记录数 --one: 使用系统表. SELECT object_name (i.id) TableName, rows as RowCnt FROM sysindex ...

  7. Hibernate注解:一对一主键关联

    情形:两个表,my_site和my_site_company,通过主键site_id唯一关联.my_site的主键是自动增加,my_site_company的主键依赖于my_site. # # Sou ...

  8. freemarker中使用shiro标签

    地址:https://github.com/jagregory/shiro-freemarker-tags下载该jar包 或者源代码文件复制到自己工程的lib下或者package中  如果使用spri ...

  9. Android设置不被系统设置改变的字体大小

    原因 从4.0开始,系统设置中“显示”可以对字体大小进行配置,这会影响到TextView等控件中文字显示的大小. 解决方案 在自定义的Activity中重写getResources方法 @Overri ...

  10. Android中MenuInflater实例

    我们知道,LayoutInflater是用来实例化整个布局文件,而MenuInflater是用来实例化Menu目录下的Menu布局文件的. 传统意义上的菜单定义需要Override Activity的 ...