def meanstdev(numlist): 返回一个序列的均值和标准差;def
mindivnum(numlist,limit):找出一个整数list (numlist)的最小公倍数,寻找的范围为1~limit;def
dec2bin(num,digits):将num转化为2进制字符串,并保留低...
分类:
其他好文 时间:
2014-05-28 03:20:03
阅读次数:
212
/*【程序6】
题目:输入两个正整数m和n,求其最大公约数和最小公倍数。
1.程序分析:利用辗除法。*/
packagetest;
publicclasstest{
//最大公约数
publicstaticintcommonisor(intn,intm){
intmax=(n>=m)?n:m;
intmin=(n>=m)?m:n;
intr=max%min;
while(r!=0)
{
max=min;
m..
分类:
编程语言 时间:
2014-05-27 04:04:03
阅读次数:
374
CSDN链接两个自然数的积等于这两个数的最大公约数与最小公倍数的积。求最大公约数的方法:1、辗转相除法:辗转相除法又称为欧几里德算法其计算原理依赖于下面的定理:定理:gcd(a,b)
= gcd(b,a mod b) (a>b 且a mod b 不为0)当b==0时,gcd(a,b)中的a即为最大公...
分类:
其他好文 时间:
2014-05-26 11:19:49
阅读次数:
263
Problem Description
Some days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it.
But I also don't want to use...
分类:
其他好文 时间:
2014-05-25 16:39:53
阅读次数:
266
算法训练 最大最小公倍数
时间限制:1.0s 内存限制:256.0MB
问题描述
已知一个正整数N,问从1~N中任选出三个数,他们的最小公倍数最大可以为多少。
输入格式
输入一个正整数N。
输出格式
输出一个整数,表示你找到的最小公倍数。
样例输入
9
样例输出
504
数据规模与约定
...
分类:
其他好文 时间:
2014-05-25 07:33:56
阅读次数:
243
Smallest multiple
Problem 5
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly di...
分类:
其他好文 时间:
2014-05-23 01:51:13
阅读次数:
261
知识点:
最小公倍数(a,b)=a*b/最大公约数(a,b)
Party
Description
The CEO of ACM (Association of Cryptographic Mavericks) organization has...
分类:
其他好文 时间:
2014-05-22 11:41:33
阅读次数:
354
题目描述
给你一个有N个数的集合S和一个数X,判断是否存在S的一个子集,子集里的数的最小公倍数正好是X。
输入
第一行是数据组数T。 接下来有多组数据,每组数据包含两行: 第一行有2个数N和X,1
输出
对于每一组数据,输出一行"Case #X: Y",X是第几组数据,Y是Yes或No。
样例输入
2
4 20
2 3 4 5
3 61
3 4 5
样例输出
Case #1: ...
分类:
其他好文 时间:
2014-05-22 09:33:09
阅读次数:
180
本文出自:http://blog.csdn.net/svitter
题意:给你一个公约数,...
分类:
其他好文 时间:
2014-05-21 14:36:27
阅读次数:
206
SOl:将原题改为枚举N的每一对因子,计算其是否互素即可。
#include
#include
#include
using namespace std;
inline int gcd(int a,int b)
{
return b==0?a:gcd(b,a%b);
}
int main()
{
int n,T,i,j;
scanf("%d",&T);
while(T...
分类:
其他好文 时间:
2014-05-21 07:07:00
阅读次数:
273