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. 转-ViewPager组件(仿微信引导界面)

    http://www.cnblogs.com/lichenwei/p/3970053.html 这2天事情比较多,都没时间更新博客,趁周末,继续继续~ 今天来讲个比较新潮的组件——ViewPager ...

  2. JAVA赋值运算符

    赋值预算符,简单来说就是把以及定义了值的变量值赋值给刚定义的变量 例如,a学员,与b学员的成绩相同,a学员是80分,我们根据a学员的成绩,输出b学员的成绩. public class Test{ pu ...

  3. CentOS 6.5 网络配置(转载)

    From:http://blog.csdn.net/leave00608/article/details/19814063 1.配置网卡IP地址 vim /etc/sysconfig/network- ...

  4. Ubuntu查看磁盘空间命令(转载)

    linux中df命令的功能是用来检查linux服务器的文件系统的磁盘空间占用情况.可以利用该命令来获取硬盘被占用了多少空间,目前还剩下多少空间等信息. 1.命令格式: df [选项] [文件] 2.命 ...

  5. 查看MySQL的错误日志的方法

    我们经常在运行MySQL时会出一些错误,也经常被这些错误搞得晕头转向.当然解决这些问题的首要任务是找到日志信息. MySQL的错误信息是在data目录下的,且文件名为<hostname>. ...

  6. (easy)LeetCode 198.House Robber

    You are a professional robber planning to rob houses along a street. Each house has a certain amount ...

  7. java 数据结构

    二叉树: 存储结构:顺序存储结构和链式存储结构 二叉树的先根遍历的递归与非递归算法 二叉树的中根遍历的递归与非递归算法 二叉树的后根遍历的递归与非递归算法 二叉树的层次遍历的递归与非递归算法 e.g. ...

  8. IntelliJ IDEA显示行号方法

    File->Settings->Editor->General->Appearence->Show line numbers

  9. java——操作文件

    Java文件操作,共实现了文件复制(单个文件和多层目录文件),文件移动(单个文件和多层目录文件),文件删除(单个文件和多层目录文件),文件压缩 (单个文件),文件解压(单个文件),文件分割(将一个大文 ...

  10. Bootstrap 3 How-To #3 布局

    对于 Web 开发来说,一个永远的话题是如何创建一个跨浏览器兼容的布局.许多年来,各种框架使用各种技术来解决这个问题.Bootstrap 使用了一个不同的方式来解决这个问题.基于 960 像素的布局 ...