CDZSC_2015寒假新人(2)——数学 A
Description
Input
Output
Sample Input
3 5 7 15
6 4 10296 936 1287 792 1
Sample Output
10296
#include<iostream>
#include<cstdio>
using namespace std;
int LCM(int a,int b)
{
int m=a,n=b;
int c;
while(b!=)//辗转相除法
{
c=a%b;
a=b;
b=c;
}
return m/a*n;//之前写的m*n/a 结果是错的 改成这样之后终于AC了
}
int main()
{
int a,n,m,num;
scanf("%d",&n);
while(n--)
{
num=;
scanf("%d",&m);
while(m--)
{
scanf("%d",&a);
num=LCM(a,num);
}
printf("%d\n",num);
}
}
CDZSC_2015寒假新人(2)——数学 A的更多相关文章
- CDZSC_2015寒假新人(2)——数学 P
P - P Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status ...
- CDZSC_2015寒假新人(2)——数学 H
H - H Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status ...
- CDZSC_2015寒假新人(2)——数学 G
G - G Time Limit:3000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status ...
- CDZSC_2015寒假新人(2)——数学 D
D - D Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status ...
- CDZSC_2015寒假新人(2)——数学 C
C - C Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status ...
- CDZSC_2015寒假新人(2)——数学 B
B - B Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status ...
- CDZSC_2015寒假新人(1)——基础 i
Description “Point, point, life of student!” This is a ballad(歌谣)well known in colleges, and you mus ...
- CDZSC_2015寒假新人(1)——基础 h
Description Ignatius was born in a leap year, so he want to know when he could hold his birthday par ...
- CDZSC_2015寒假新人(1)——基础 g
Description Ignatius likes to write words in reverse way. Given a single line of text which is writt ...
随机推荐
- Opencv 函数
1.cvLoadImage:将图像文件加载至内存: 2.cvNamedWindow:在屏幕上创建一个窗口: 3.cvShowImage:在一个已创建好的窗口中显示图像: 4.cvWaitKey:使程序 ...
- Emacs显示行号
在配置.emacs文件中加上 (global-linum-mode t) 启动emacs后按 m-x global-linum-mode 就可以显示行号,但是每次打开emacs,要重新 ...
- Linux设置自启动
启动大致过程:bootloader-->内核-->内核模块-->挂载根文件系统-->init进程 init进程是非内核进程中第一个被启动运行的,因此它的进程编号PID的值总是1 ...
- CI框架uri去掉index.php
CI框架的入口是index.php,所以url实际上要多出一个index.php,非常不美观.我使用的是apache服务器,要开启mod_rewrite服务才可以. sudo a2enmod rewr ...
- Aphache VFS
http://blog.csdn.net/hemingwang0902/article/details/4733911 http://jackyrong.iteye.com/blog/1330946 ...
- Injector Job深入分析
Injector Job的主要功能是根据crawlId在hbase中创建一个表,将将文本中的seed注入表中. (一)命令执行 1.运行命令 [jediael@master local]$ bin/n ...
- CSS样式总结
CSS: Cascading Style Sheet,层叠样式表 Css由三部分组成:选择符.样式属性.值: 基本语法:选择符 {样式属性:值:样式属性:值.....} 一,选择器 常用的选择器有:标 ...
- php给一张图片加上水印效果
<?php /** * 功能:给一张图片加上水印效果 * $i 要加水印效果的图片 * $t 水印文字 * $size 文字大小 * $pos 水印的位置 * $color 文字的颜色 * $f ...
- 写下你的第一个Django应用,第三部分
这篇指南开始于指南2结束的地方.我们将继续web投票应用和集中注意力在创建公共接口——“view” 理念 一个视图在你的Django应用中一个web页面的“品种”和它通常作为一个特定的函数以及有一个特 ...
- uiautomator <一> 编译运行
uiautomator testcase 一.新建Java工程 二.导入lib包 android.jar 和 uiautomator.jar ,选中点击右键Add to buildPath 三.新建测 ...