H
来源:互联网 发布:网络运营商电话 编辑:程序博客网 时间:2024/05/09 13:19
求n个数的最小公倍数。
2 4 63 2 5 7
1270
#include <stdio.h>int f(int x,int y){int t, i,min;min=x>=y?y:x; for(i=1;i<=min;i++){ if(x%i==0 && y%i==0) t=i;} return t;}int main(){int i,n,x,y; while(scanf("%d",&n)!=EOF){ scanf("%d",&x); for(i=1;i<n;i++) { scanf("%d",&y); x=x/f(x,y)*(y/f(x,y)) *f(x,y); } printf("%d\n",x);}return 0;}
阅读全文
0 0
- h
- h
- h
- ,h
- h
- h
- H
- h
- h
- h
- H
- h
- H
- H
- h
- H
- H
- h
- 决策树(Decision Tree)
- android helloCharts 柱状图小结
- 我发起一个http url,本地没问题,发布到测试环境后,报错post 400 bad request,原来是测试的tomcat版本比较高,它对post的长度做了限制。
- Spring学习笔记
- html 符号
- H
- 【1018】选太子
- 如何判断网站是否使用了HTTP/2
- 对String字符串的一些处理
- [tensorflow] which dimension to reduce in tf.reduce_sum()
- iOS应用启动launchOptions字典中的key值
- 为本地开发搭建环境(英雄编辑器)
- Linux进程间通信——消息队列
- Android中工厂模式