HDU_2028 Lowest Common Multiple Plus
来源:互联网 发布:数据结构查找算法总结 编辑:程序博客网 时间:2024/04/30 14:45
这题是求n个整数的最小公倍数,
第一个数是n,后面紧跟n个整数.
很简单,只用了两个for循环,
然后就是flag的使用.
下面是代码:
#include <stdio.h>#include <iostream>using namespace std;int main(){int n, i, j, x, a[100];while (cin >> n){for (i = 0; i < n; i ++){cin >> a[i];}for (j = 1; ; j ++){int flag = 0;for (x = 0; x < n; x ++){if (j % a[x] == 0)flag ++;}if (flag == n){cout << j << endl;break;}}}return 0;}
- HDU_2028 Lowest Common Multiple Plus
- Lowest Common Multiple Plus
- Lowest Common Multiple Plus
- Lowest Common Multiple Plus
- Lowest Common Multiple Plus
- Lowest Common Multiple Plus
- Lowest Common Multiple Plus
- Lowest Common Multiple Plus
- Lowest Common Multiple Plus
- Lowest Common Multiple Plus
- Lowest Common Multiple Plus
- Lowest Common Multiple Plus
- Lowest Common Multiple Plus
- 2028 Lowest Common Multiple Plus
- 【hdoj2028】Lowest Common Multiple Plus
- HDU - Lowest Common Multiple Plus
- HDU2028:Lowest Common Multiple Plus
- hdoj_2028 Lowest Common Multiple Plus
- VC 创建一个图标菜单
- 怎么清楚TortoiseSVN的用户和密码
- $.ajax()例子
- ios开发环境安装
- myeclipse报错:Could not open the editor: Invalid thread access .
- HDU_2028 Lowest Common Multiple Plus
- 民间治疗中耳炎偏方
- JAVA中如何使用freemaker模版进行输出
- 笔记本应用电视机屏幕看电影
- “石油无机论”颠覆对于石油的认知
- 使C++ Builder编译程度独立运行
- 移动互联网——让用户少点击一次
- 思科预计移动连接设备的数量将在2013年底超出范围
- expdp ORA-39165: Schema DBSNMP was not found