HDU 1108(最小公倍数)
来源:互联网 发布:unity3d 模型形状mask 编辑:程序博客网 时间:2024/05/21 11:17
题意:如题。
#include <iostream>#include <vector>using namespace std;int dd(int x, int y);void main(){ vector<vector<int> > tmpbox; unsigned int a; unsigned int b; while (cin >> a >> b) { if (a > 1000 || b > 1000) continue; vector<int> _tmp; _tmp.push_back(a); _tmp.push_back(b); tmpbox.push_back(_tmp); } for (vector<vector<int> >::iterator it = tmpbox.begin(); it != tmpbox.end(); ++it) { int ntmp = dd((*it)[0], (*it)[1]); cout << (*it)[0] / ntmp * (*it)[1] << endl; }}int dd(int x, int y){ if(x < y) { x = x ^ y; y = x ^ y; x = x ^ y; } while(y != 0) { x = x % y; x = x ^ y; y = x ^ y; x = x ^ y; } return x;}
#include <iostream>using namespace std;long gcd(long m, long n){while (n != 0){long rem = m % n;m= n;n=rem;}return m;}#define change(m, n) m=m^n,n=m^n,m=m^nvoid main(){long m, n;while (cin >> m>> n){if (n>m)change(m, n);cout << m/gcd(m,n)*n<<endl;}}
0 0
- hdu 1108 最小公倍数
- HDU 1108 最小公倍数
- HDU 1108 最小公倍数
- HDU 1108 最小公倍数
- hdu-1108 最小公倍数
- hdu 1108 最小公倍数
- HDU 1108 最小公倍数
- hdu 1108 最小公倍数
- hdu-1108-最小公倍数
- HDU 1108 最小公倍数
- hdu/hdoj 1108 最小公倍数
- hdu 1108 最小公倍数
- HDU 1108(最小公倍数)
- HDU 1108 最小公倍数
- HDU 1108 最小公倍数
- HDU 1108 最小公倍数
- HDU 最小公倍数 1108 【水】
- hdu 1108 最小公倍数
- swt 常用样式
- linux下中文乱码问题解决
- GCD使用(三)执行延时操作
- 分析实验室网络拓扑结构
- VC USB 相关笔记
- HDU 1108(最小公倍数)
- struts2标签 ongl取值
- web.xml文件详细解析
- 如何收集用来诊断性能问题的10046 Trace(SQL_TRACE) (文档 ID 1523462.1)
- LearnVSXNow!-#4 创建一个带有工具窗的Package
- 设计模式归类
- Serv-U详细配置图文教程
- 图文详解YUV420数据格式
- LearnVSXNow!-#5 VSX的基本概念