48-题目1438:最小公倍数

来源:互联网 发布:淘宝售后客服工资算法 编辑:程序博客网 时间:2024/05/20 23:32

http://ac.jobdu.com/problem.php?pid=1438

题目也是比较简单
#include<iostream>#include<fstream>using namespace std;int main(){int A,B,temp;ifstream cin("data.txt");while (cin >> A >> B){temp = A > B ? A : B;  //取A,B中的较大值while (1){if (temp % A == 0 && temp % B == 0)break;temp++;}cout << temp << endl;}//end of whilesystem("pause");return 0;}


0 0
原创粉丝点击