【杭电1108】最小公倍数
2016-07-24 20:33
218 查看
最小公倍数
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d
& %I64u
Submit Status Practice HDU
1108
Description
给定两个正整数,计算这两个数的最小公倍数。
Input
输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.
Output
对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。
Sample Input
10 14
Sample Output
70
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d
& %I64u
Submit Status Practice HDU
1108
Description
给定两个正整数,计算这两个数的最小公倍数。
Input
输入包含多组测试数据,每组只有一行,包括两个不大于1000的正整数.
Output
对于每个测试用例,给出这两个数的最小公倍数,每个实例输出一行。
Sample Input
10 14
Sample Output
70
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#include<cstdio> int max(int a,int b) { if(a%b==0) return b; else return max(b,(a%b)); } int min(int a,int b) { return a*b/max(a,b); } int main() { int a,b,t; while(scanf("%d%d",&a,&b)!=EOF) { t=min(a,b); printf("%d\n",t); } return 0; }
相关文章推荐
- Java servlet上传文件(照片视频)
- 栈实现,不是用template做的.
- 使用jersey上传图片到图片服务器
- x64内核内存空间结构
- 机房重构之七层登陆
- 反转链表
- android按钮图片和文本居中的代码-你躺枪了吗
- 【总结】Data Hiding in BTC Images Using Quantization Level Modification and Perturbation Technique
- hdu 2480 贪心+简单并查集
- Holodesk VS CarbonData
- 逻辑回归.感知器算法
- POJ 1236 Network of Schools (强连通分量tarjan)
- sql语句优化(一)
- js注意事项04
- 杭电OJ 1015 Safecracker
- Nginx压力测试工具之WebBench
- 【FJ 2013】继任者
- 关于Cocos2d-x随机数的生成
- [转] c# 操作Word
- 深入理解Windows X64调试