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 ...
随机推荐
- 一个好玩的jq+php实现转盘抽奖程序
前台页面: <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <met ...
- python学习(四)五数连珠
中午有段时间,模仿<五子连珠>写了一段代码,运行截图如下: import random # for random.randrange() import os # for input() b ...
- 利用Azure高级存储搭建高性能Linux服务器(2)
我们首先来测试随机写的IOPS,可以看到随机写的IOPS可以达到,顺序写的IOPS可以达到: $ sudo fio -filename=/data/testfile -direct=1 -iodept ...
- 用户子查询,用case
select satisfy.STARTTIME,cc.C_CrmID,cc.C_Name ClientName,be.C_NAME,count(yskj.c_id) PhoneSum,sum(ca ...
- python小程序之并发连接
import threading import socket import time def conn(): cli = socket.socket() cli.connect(("58.6 ...
- java读取property文件
property文件中: url = jdbc:mysql://localhost:3306/resume user= root pwd = 123 java代码读取: packa ...
- 膜拜一个神奇的女人——Hedy Lamarr
她演绎了首部露点电影.经历了六次婚姻.出版了首本自曝隐私的自传,还曾入室行窃过两次——在这样一个饱受争议的大环境下,她还能在60多年前提出“跳频”技术和一系列无线信号技术的全新概念,其中,“跳频”技术 ...
- Win8.1 MSDN各版本下载(64位/32位,简体中文,繁体中文,英文),X86&X64,EN,CHS,CHT
英文64位ed2k://|file|en_windows_8_1_x64_dvd_2707217.iso|3899295744|8E604054013D21209B851E41DC19F6F5|/ 英 ...
- Linux kernel API的查看
一般来说Linux上查看一些函数API的说明咱们可以man一下.man 2是syscall,man 3是一些库的函数API. 以下是man sections的一些说明 The table below ...
- centos 6.4 更新源地址
执行如下命令: mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.old vim /etc/yum.repo ...