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. ruby中的reject和reject!

    reject和reject!reject返回不满足代码块的元素数组reject!删除数组中满足代码块的元素 a=[1,2,3,5]a.reject! {|x| x<4}p a #[5] b = ...

  2. samba共享修改匿名用户为非nobody

    samba共享修改匿名用户为非nobody 1)linux的samba用户,如果开启匿名用户登陆共享权限,security 设置为 share ,配置如下:[root@centos69:~]$grep ...

  3. 20145305 《Java程序设计》实验四

    Android开发基础 安装过程没有截图 给出安装参考链接 http://ask.android-studio.org/?/article/9 实验结果截图: 完成HelloWorld项目,显示自己的 ...

  4. 回朔法/KMP算法-查找字符串

    回朔法:在字符串查找的时候最容易想到的是暴力查找,也就是回朔法.其思路是将要寻找的串的每个字符取出,然后按顺序在源串中查找,如果找到则返回true,否则源串索引向后移动一位,再重复查找,直到找到返回t ...

  5. 在MS CRM 4.0中引用JS文件

    引用: http://blog.csdn.net/qzw4549689/article/details/6027987 1.编写好JS代码,在ISV目录下新建一个目录javascripts,将JS文件 ...

  6. mysql如何给汉字按照首字母顺序排序

    select * from 表名 order by convert(列明 USING gbk) COLLATE gbk_chinese_ci asc

  7. linux locate: command not found

    装好系统发现使用locate查找文件,提示 -bash: locate: command not found yum install locate 无效,看来locate不是软件名称 [root@ce ...

  8. Python的方法分类

    1.Python的类方法,实例方法,和静态方法 class S(object): def Test(self): print("TEST") @classmethod#类方法 de ...

  9. Regional Changchun Online--Alisha’s Party

    Alisha's Party Time Limit: 3000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) ...

  10. sqlite支持的数据库类型

    http://www.sqlite.org/datatype3.html 默认只支持:NULL,INTEGER,REAL,TEXT,BLOB