Smallest multiple
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的更多相关文章
- projecteuler 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 ...
- 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 ...
- 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 ...
- CUDA C Programming Guide 在线教程学习笔记 Part 10【坑】
▶ 动态并行. ● 动态并行直接从 GPU 上创建工作,可以减少主机和设备间数据传输,在设备线程中调整配置.有数据依赖的并行工作可以在内核运行时生成,并利用 GPU 的硬件调度和负载均衡.动态并行要求 ...
随机推荐
- J2EE总结(2)——Servlet/JSP
Servlet/JSP Servlet定义:部署在java的Webserver上的组件.整个java服务端程序都构建在Servlet之上,以多线程方式提 供服务,具有效率高.可扩展,可移植的特点. J ...
- 使用WCF订阅替换轮训
之前因为某些特定岗位的人不知道是不方便还是什么的原因,所以随便做了个独立于所有系统之外的邮件审批服务,功能是那些人在邮件里给待审批单据发个“同意”就自动审批通过,大致分为3部分:第一部分每隔固定时间去 ...
- [问题]安装express,已经加了-g,还是找不到express命令
安装express时使用如下命令: npm install -g express 但是在命令行还是找不到express 手动将路径D:\Program Files (x86)\nodejs\node_ ...
- Android开发Tips-1
打算记录一些自己在开发过程中遇到的一些技巧性代码,方便以后遇到相似功能时能够快速的找到,那就从这里开始吧. 1,如何截取当前屏幕(不包括当前Activity的Title)并分享: a,获取当前Acti ...
- (转载)Log4Net 在多层项目中的使用小记
(原创)Log4Net 在多层项目中的使用小记 这几天刚好在调整一个项目,把一些自己不是很清楚的东西先试验一下,这篇文章主要是对我在项目中需要使用Log4Net的一些记录.网上有很多相关的教程,但是各 ...
- win8 客户端源码
博客园cnblogs for win8 托管到GitHub开源 中午研究了下GitHub ,然后把博客园cnblogs win8 客户端源码放到了上面. 源码网址是: https://github ...
- iOS基础 - 内存分析
一.内存的重要性 程序是否可用的最根本的制约因素. 十分影响用户体验. 程序的crash有很多情况都是内存的原因. 二.iOS平台内存警告机制 iOS系统不支持虚拟内存,一旦出现内存不足的情况,iOS ...
- String类重写
#include <iostream> #include<string.h> using namespace std; class String { int length; i ...
- ASP.NET交互Rest服务接口(Jquery的Get与Post方式)
ASP.NET交互Rest服务接口(Jquery的Get与Post方式) 本文将通过一个简单的实例,介绍如何创建一个Rest服务接口,以及通过JQUERY去对它进行调用;主要采取两种方式分别为Get跟 ...
- 使用STL处理分支限界法处理最优装载问题
使用STL处理分支限界法处理最优装载问题 #include <iostream>#include <vector>#include <queue>#include ...