projecteuler Smallest multiple
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的更多相关文章
- Smallest multiple
problem 5:Smallest multiple 题意:求最小的正数,使得其可以被1-20整除 代码如下: #ifndef PRO5_H_INCLUDED #define PRO5_H_INCL ...
- (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 ...
- 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 ...
- Python练习题 033:Project Euler 005:最小公倍数
本题来自 Project Euler 第5题:https://projecteuler.net/problem=5 # Project Euler: Problem 5: Smallest multi ...
- Types of compression algorithms
http://www.html5rocks.com/en/tutorials/speed/img-compression/ Types of compression algorithms There ...
- PE 001~010
题意: 001(Multiples of 3 and 5):对小于1000的被3或5整除的数字求和. 002(Even Fibonacci numbers):斐波那契数列中小于等于4 000 000的 ...
- Alignment And Compiler Error C2719 字节对齐和编译错误C2719
Compiler Error C2719 'parameter': formal parameter with __declspec(align('#')) won't be aligned The ...
- Problem5-Project Euler
Smallest multiple 2520 is the smallest number that can be divided by each of the numbers from 1 to ...
- Project Euler Problem5
Smallest multiple Problem 5 2520 is the smallest number that can be divided by each of the numbers f ...
随机推荐
- 自己动手写ORM
http://blog.csdn.net/sundacheng1989/article/category/1350100
- REST架构实质(转)
REST(Representational State Transfer) 曾经被误解为只是CRUD(增删改查),从这个层面上,好像REST只是和RPC一个层面的东西,没有什么了不起,其实这些都是对R ...
- 区分DPI、分辨率(PPI)、图像的物理大小、像素宽度
分辨率都知道,越高越清晰. 一.描述分辨率的单位有: dpi(点每英寸).lpi(线每英寸)和ppi(像素每英寸).但只有lpi是描述光学分辨率的尺度的.虽然dpi和ppi也属于分辨率范畴内的单 ...
- arm-linux-objdump
一.arm-linux-objdump常用来显示二进制文件信息,常用来查看反汇编代码二.常用选项:1.-b bfdname 指定目标码格式2.—disassemble或者-d 反汇编可执行段3.—di ...
- ASPxGridView改变列颜色
protected void ASPxGridView1_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs ...
- Oracle中的单行函数
Oracle中的单行函数 1 字符函数 UPPER()--将字符串转换为大写 SELECT UPPER('abc') FROM dual; LOWER()-将字符串转换为小写 SELECT LOWER ...
- WPF更新数据源
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windo ...
- Linux Hugepage ,AMM及 USE_LARGE_PAGES for oracle 11G(转载)
1. Hugepage基本概念 系统进程是通过虚拟地址访问内存,但是CPU必须把它转换成物理内存地址才能真正访问内存.为了提高这个转换效率,CPU会缓存最近的“虚拟内存地址和物理内存地址”的 ...
- access的查询中具体到时间的时候使用“#”
如果不使用#的情况下会导致出现操作符丢失的错误提示,因此再比较时间的时候将日期和时间用#包括起来: 例如: SELECT *FROM ms_record where dateTo > #2015 ...
- (转)直接拿来用!最火的iOS开源项目(一)
1. AFNetworking 在众多iOS开源项目中,AFNetworking可以称得上是最受开发者欢迎的库项目.AFNetworking是一个轻量级的iOS.Mac OS X网络通信类库,现在是G ...