problem 5:Smallest multiple

题意:求最小的正数,使得其可以被1-20整除

代码如下:

 #ifndef PRO5_H_INCLUDED
 #define PRO5_H_INCLUDED

 #include "prime.h"

 namespace pro5{
     long long solve(){
         ;
         ;i<=;++i)
             ans=lcm(ans,i);
         return ans;
     }
 }

 #endif // PRO5_H_INCLUDED

有关函数:

 long long gcd(long a,long b){
     ?a:gcd(b,a%b);
 }

 long long lcm(long a,long b){
     return a/gcd(a,b)*b;
 }

Smallest multiple的更多相关文章

  1. projecteuler Smallest multiple

    2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any rema ...

  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. Types of compression algorithms

    http://www.html5rocks.com/en/tutorials/speed/img-compression/ Types of compression algorithms There ...

  5. PE 001~010

    题意: 001(Multiples of 3 and 5):对小于1000的被3或5整除的数字求和. 002(Even Fibonacci numbers):斐波那契数列中小于等于4 000 000的 ...

  6. Alignment And Compiler Error C2719 字节对齐和编译错误C2719

    Compiler Error C2719 'parameter': formal parameter with __declspec(align('#')) won't be aligned The ...

  7. Problem5-Project Euler

    Smallest multiple   2520 is the smallest number that can be divided by each of the numbers from 1 to ...

  8. Project Euler Problem5

    Smallest multiple Problem 5 2520 is the smallest number that can be divided by each of the numbers f ...

  9. CUDA C Programming Guide 在线教程学习笔记 Part 10【坑】

    ▶ 动态并行. ● 动态并行直接从 GPU 上创建工作,可以减少主机和设备间数据传输,在设备线程中调整配置.有数据依赖的并行工作可以在内核运行时生成,并利用 GPU 的硬件调度和负载均衡.动态并行要求 ...

随机推荐

  1. [译]JDK 6 and JDK 7中的subString()方法

    (说明,该文章翻译自The substring() Method in JDK 6 and JDK 7) 在JDK 6 and JDK 7中的substring(int beginIndex, int ...

  2. 在ubuntu纯字符gdb界面下来开发调试嵌入式ARM

    前面一个帖子介绍了使用eclipse来开发STM32的固件,但有的时候使用Eclipse的GDB调试器会崩溃掉,反复这样造成我们开发的效率降低,信心也会受一打击. 最近接触到的许多源码,就是在linu ...

  3. WebIM(1)

    WebIM系列文章 之前笔者发布的云翔在线软件平台中已经包含了一个功能相对比较齐全的WebIM,这个系列的文章就是介绍如何开发出功能类似的WebIM,在文章开始前,先介绍一下相关的技术: 1.Come ...

  4. Javascript实例技巧精选(8)—计算当月剩余天数

    >>点击这里下载完整html源码<< 截图如下: 利用Javascript在网页上计算当前月份的剩余天数,相应代码如下: <script language="J ...

  5. Java基础之集合:概览

    Java Basic->Collections->Overview 先抛一个问题,用一个类似树形的结构,介绍下 Java 的集合类数据结构:有哪些,从简单到复杂,有怎么样的继承关系. 下面 ...

  6. 关于PHP 缓冲区

    最权威的资料:http://php.net/manual/en/function.flush.php 里面有全世界的开发者的留言.常见问题都有讨论. 再说一下PHP 缓冲区相关的. web服务器 如 ...

  7. 正则表达式测试分析工具Expresso

    正则表达式测试分析工具Expresso 一个正则表达式的小工具--myRegexHelper   把以前做的一个功能抽取出来做成一个小的正则表达式测试工具.没什么特色,有两点功能: 一.方便的测试正则 ...

  8. Aforge.net 一个专门为开发者和研究者基于C#框架设计

    时间过得真快啊,转眼今年就要过去了,大半年都没有写博客了,要说时间嘛,花在泡妹子和搞英语去了,哈哈...前几天老大问我 怎么这么长时间都没写博客了,好吧,继续坚持,继续分享我的心得体会. 这个系列我们 ...

  9. poj 2184(dp变形,进一步加深01背包)

    点击打开链接 题意: 给你n个物品,每个物品都有两个属性,s和f,要求选择一些物品,使sum(s)+sum(f)最大,并且sum(s)>=0&&sum(f)>=0, 根据0 ...

  10. 线程:ThreadLocal实现线程范围内共享变量

    在web应用中,一个请求(带有请求参数)就是一个线程,那么如何区分哪些参数属于哪个线程呢?比如struts中,A用户登录,B用户也登录,那么在Action中怎么区分哪个是A用户的数据,哪个是B用户的数 ...