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. [android] 百度地图开发 (两).所在地的城市定位和城市POI搜索

    一个. 百度地图城市位置和POI搜索知识       上一篇文章"百度地图开发(一)"中讲述了怎样申请百度APIKey及解决显示空白网格的问题.该篇文章主要讲述怎样定位城市位置.定 ...

  2. 成C++应用程序世界------异常处理

    一. 概述 C++自身有着很强的纠错能力,发展到现在,已经建立了比較完好的异常处理机制.C++的异常情况无非两种,一种是语法错误,即程序中出现了错误的语句,函数,结构和类,致使编译程序无法进行.还有一 ...

  3. 基于C++11线程池

    1.包装线程对象 class task : public std::tr1::enable_shared_from_this<task> { public: task():exit_(fa ...

  4. mysql基础之存储引擎

    原文:mysql基础之存储引擎 数据库对同样的数据,有着不同的存储方式和管理方式,在mysql中,称为存储引擎 常用的表的引擎 Myisam ,批量插入速度快, 不支持事务,锁表 Innodb, 批量 ...

  5. C#程序员阅读的书籍

    推荐几本C#程序员阅读的书籍   楼主这些年一直追随微软技术,也看了不少书籍,整理出一些个人认为不错的经典,推荐给各位阅读,以共同进步. 推荐顺序是由浅入深,深入浅出. <Professiona ...

  6. .NET MVC4 实训记录之三(EntityFramework 与枚举)

    EntityFramework对枚举的引入是从版本5开始的(如果没有记错的话).枚举可以很大程度上提高对程序的可读性.那么在EntityFramework的CodeFirst模式下,如何使用枚举呢?答 ...

  7. 订单处理(c#实现)

    State模式的经典应用场景:订单处理(c#实现) State模式在对象内部状态发生变化的时候,改变自身的行为,这通常是通过切换内部状态对象实现的,对象将自身在各个状态的行为推给了状态对象,从而解开了 ...

  8. Scientific Toolworks Understand for linux安装方法

    1.首先从官网http://www.scitools.com/download/index.php下载Linux版本 2.解压到安装目录下: 32位:gzip -cd Understand-3.1.6 ...

  9. Hadoop将本地文件复制到Hadoop文件系统

    代码: package com.hadoop; import java.io.BufferedInputStream; import java.io.FileInputStream; import j ...

  10. 记录在IIS中安装部署Orchard遇到的问题

    本机环境:Windows 8.1 + IIS8.5 + VS2013+SQLServer2012 首先是从官网直接下载Orchard.Web 1.7.2版的安装包,在本机IIS上部署,按官方文档一步步 ...