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 ...
随机推荐
- 转-android 支付宝SDK集成
http://blog.csdn.net/kroclin/article/details/40746779 一.前言 最近做的项目刚好要集成支付宝,上网找了很多资料,介绍得感觉不是很全面,所以我经过这 ...
- 防止sql注入。xss攻击 方法
//防止sql注入.xss攻击 /** * 过滤参数 * @param string $str 接受的参数 * @return string */ publ ...
- JAVA坏境变量中的JAVA_HOME path classpath 的设置与作用。
在把jdk安装到计算机中之后,我们来进行设置使java环境能够使用. 首先右键点我的电脑.打开属性.然后选择“高级”里面的“环境变量”,在新的打开界面中的系统变量需要设置三个属性“JAVA_HOME” ...
- spring mvc视频
视频内容: 1.下载spring mvc以及spring mvc示例演示http://pan.baidu.com/s/1kTHRfDH 2.配置完善&初步探究控制器拦截http://pan.b ...
- Servlet中的请求转发和重定向
跳转和重定向 有的时候客户端请求到达服务端后需要对请求重新转发到其它Servlet甚至别的服务器,这就需要跳转和重定向. 区别 一般来说,跳转是服务器内部跳转,例如将请求从一个Servlet转发给另外 ...
- div的contenteditable和placeholder蹦出的火花
今天在做手机端发布描述内容时,需要实现换行,还需要有plachholder. 在文本框中换行自然想到了textarea. 问题似乎已经解决了,但是当内容发布后,在html中显示换行都丢失了. 这个时候 ...
- codeforces 2B The least round way 【DP】
VJ上可找到中文题意. 思路: 首先分解有多少2与多少5.接下来就是dp. 分两次,一次是根据2的数量贪心,另外一次是根据5的数量贪心,看哪一次乘积的末尾0最少. 需要注意的是两点: 1.输入有0的情 ...
- POJ 2154 【POLYA】【欧拉】
前记: TM终于决定以后干啥了.这几天睡的有点多.困饿交加之间喝了好多水.可能是灌脑了. 切记两件事: 1.安心当单身狗 2.顺心码代码 题意: 给你N种颜色的珠子,串一串长度问N的项链,要求旋转之后 ...
- poj 2253 Frogger dijkstra算法实现
点击打开链接 Frogger Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 21653 Accepted: 7042 D ...
- Node.js发送邮件
1.使用nodemailer模块 var nodemailer = require("nodemailer"); 2.代码如下 exports.send_email = funct ...