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. 转--Invalidate和postInvalidate的更新view区别

    Android中实现view的更新有两组方法,一组是invalidate,另一组是postInvalidate,其中前者是在UI线程自身中使用,而后者在非UI线程中使用. Android提供了Inva ...

  2. 帝国cms常用变量总结

    一.常用变量 当前栏目ID $GLOBALS['navclassid'] 当前父栏目ID $class_r[$cid]['bclassid'] 栏目路径 $class_r[栏目ID]['classpa ...

  3. java网络编程之TCP实例

    Dgram类 package Socket; import java.net.DatagramPacket; import java.net.InetAddress; public class Dgr ...

  4. PyDev-Python的Eclipse插件安装

    PyDev官网:http://marketplace.eclipse.org/node/114 安装方法: 1,打开Eclipse,如果是初次使用,关闭欢迎页面,否则无法按照我说的方法安装. 2,打开 ...

  5. U盘安装Linux CentOS 6.5 64位操作系统(来自互联网)

    从centOS6.5开始直接把iso文件写入u盘就行了. 方法1:windows平台:1.用UltraISO打开iso(如:CentOS-6.5-x86_64-bin-DVD1.iso)2.然后点“启 ...

  6. java 线程同步 原理 sleep和wait区别

    java线程同步的原理java会为每个Object对象分配一个monitor, 当某个对象(实例)的同步方法(synchronized methods)被多个线程调用时,该对象的monitor将负责处 ...

  7. 朗逸2011款 1.4t 清除保养告警灯

    朗逸2011款 1.4t 清除保养告警灯 Posted on 2015-03-01 21:06 编辑 仪表盘上有两个按钮 按住右边set键,钥匙旋转到通电状态,保持2s. 放掉set,按左边的切换按钮 ...

  8. 打开10.10.3上SSD的TRIM-黑苹果之路

    对SSD没有研究,同事提出苹果对非官方的SSD不开启TRIM,上网度了一把,对TRIM不明觉厉. 一.TRIM是怎么回事:http://bbs.feng.com/read-htm-tid-187088 ...

  9. 笔记本win7制作wifi

    笔记本win7系统, 要打开笔记本无线网卡 1. 运行 netsh wlan set hostednetwork mode=allow ssid=testwifi key=testpass model ...

  10. Appnium安装——Mac篇

    mac下搭建appium环境有两种方法: 1.直接下载appium.dmg 运行即可 2.使用node从命令行运行appium Mac下的appnium环境搭建 一.首先安装homebrew 1.首先 ...