[Templates That Are Usually Used]Least Common Multipler
来源:互联网 发布:见之不若知之 编辑:程序博客网 时间:2024/06/11 06:16
#include <iostream>#include <cstdio>#include <algorithm>using namespace std;int gcd(int a, int b){ int ans; if(a < b) swap(a, b); if(b == 0) ans = a; else ans = gcd(b, a%b); return ans;}int lcm(int a, int b){ int ans; if(a*b == 0) ans = 0; else ans = a / gcd(a, b) * b; return ans;}int main(){ int a, b, c, d; cin >> a >> b; c = gcd(a, b); d = lcm(a, b); cout << "gcd is " << c << endl; cout << "lcm is " << d << endl; return 0;}
- [Templates That Are Usually Used]Least Common Multipler
- [Templates That Are Usually Used]Greatest Common Divisor
- [Templates That Are Usually Used]Header Files Include and Pre-Process(ToBeContinued)
- Issue 111( Most important discoveries or creation are accidental; it is usually while seeking the answer to one question that
- LRU (Least Recently Used)
- LRU(Least recently used)
- LRU(Least Recently Used)
- DB2 usually used commands 常用命令 functions
- HOW TO: Debug Visual Basic COM Components That Are Used Within Active Server Pages
- Item4: Make sure that objects are initialized before they're used
- C# language features that are rarely used but can be useful
- Item 04 : Make sure that objects are initialized before they're used.
- 条款 04 make sure that objects are initialized before they're used
- Item29 Assume that move operations are not present,not cheap,and not used
- Templates-what are they?
- Least Recently Used(LRU) Cache
- HDU1019 Least Common Multiple
- Least Common Multiple
- [Templates That Are Usually Used]Greatest Common Divisor
- 生成验证码的代码
- Tor源码分析八 -- 客户端执行流程(second_elapsed_callback函数)
- CentOS 4.8 配置 nginx 和 fastcgi 运行 django 应用
- 黑马程序员_DOM(文档对象模型)
- [Templates That Are Usually Used]Least Common Multipler
- 黑马程序员_Applet程序设计
- Html A标签中 href 和 onclick用法、区别、优先级别
- 专访:前新浪网架构师徐佳转行卖水果背后的故事
- Objective-C中load和initialize方法的区别和相同点
- twisted下使用网络连接池
- 诊断High Number Of Child Cursors 导致的ORA-600[17059]
- javaEE中404错误页面配置
- java 文件复制功能的实现