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. 微软宣布.NET开发环境将开源 支持Mac OS X和Linux

    微软宣布.NET开发环境将开源 支持Mac OS X和Linux 投递人 itwriter 发布于 2014-11-13 06:58 评论(55) 有4388人阅读  原文链接  [收藏]  « » ...

  2. nginx配置文件中的location详解

    location 语法:location [=|~|~*|^~] /uri/ { … } 默认:否 上下文:server 这个指令随URL不同而接受不同的结构.你可以配置使用常规字符串和正则表达式.如 ...

  3. c#自带压缩类实现数据库表导出到CSV压缩文件

    c#自带压缩类实现数据库表导出到CSV压缩文件的方法 在导出大量CSV数据的时候,常常体积较大,采用C#自带的压缩类,可以方便的实现该功能,并且压缩比例很高,该方法在我的开源工具DataPie中已经经 ...

  4. valuechange(动态的监听input,textarea)

    valuechange(动态的监听input,textarea)之前值,之后值的变化 jQuery封装自定义事件--valuechange(动态的监听input,textarea)之前值,之后值的变化 ...

  5. iOS基础 - Copy

    copy和mutableCopy 一个对象使用copy或mutableCopy方法可以创建对象的副本 copy – 需要先实现NSCoppying协议,创建的是不可变副本(如NSString.NSAr ...

  6. 设计适用于SOA的类型

    我们经常把一个项目分层去开发,无论是通过三层来面向对象开发还是用WCF或Remoting等面向服务的方式开发,返回值只有一个,如果底层出错了我们一般写日志来记录这些错误,然后分析错误来解决问题,但用户 ...

  7. ASP.NET所谓前台调用后台、后台调用前台想到HTTP——实践篇

    由ASP.NET所谓前台调用后台.后台调用前台想到HTTP——实践篇 在由ASP.NET所谓前台调用后台.后台调用前台想到HTTP——理论篇中描述了一下ASP.NET新手的三个问题及相关的HTTP协议 ...

  8. MVC4中使用SignalR

    MVC4中使用SignalR 前言 周末在偶尔翻阅微软官网的时候看到Getting Started with SignalR and MVC 4此篇文章,知道了signalr这个东西,貌似这个出来很长 ...

  9. [wp8游戏] cocos2d-x v2.2 + VS2013 环境搭建

    [wp8游戏] cocos2d-x v2.2 + VS2013 环境搭建 by:唐小崇 http://www.cnblogs.com/tangchong 从cocos2d-x v2.1.4 以来,co ...

  10. WCF引用方式

    WCF之各种WCF引用方式 写在开头:本文内容来自 WCF全面解析中的一个经典例子,如果你已经看过了,那么可以忽略本文,本文旨在和大家分享不一样的WCF使用方法. 准备工作: 1.创建解决方案WCFS ...