题目: 给你两个数G和L,求a和b,他们的最大公约数为G和最小公倍数为L,输出a最小时的a和b。如果不存在在输出-1.Sample Input21 23 4Output for Sample Input1 2-1分析: 其实很简单,想到思路就好了,a最小时其实就是G,对应的b必然为L,当L不是G.....
分类:
其他好文 时间:
2015-07-28 17:43:58
阅读次数:
102
我最初以为这是大树乘除法问题,后来发现只是普通的求最小公倍数方法。
原题:
Least Common Multiple
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 38411 Accepted Submissio...
分类:
其他好文 时间:
2015-07-27 19:04:12
阅读次数:
108
the value A = lcm(N+1, N+2, ..., M) and the value B = lcm(1, 2, ..., M). She was surprised when she saw that A = B....
分类:
其他好文 时间:
2015-07-26 22:39:17
阅读次数:
172
最大公约数和最小公倍数:PS:最小公倍数 = 乘积 / 最大公约数http://acm.swust.edu.cn/problem/0038/#include int main(){ int m, n, i, c, t; //t为最大公约数, c为最小公倍数 scanf("%d%d", &...
分类:
其他好文 时间:
2015-07-25 18:12:25
阅读次数:
107
题意:如果一个数能被自己各个位的数字整除,那么它就叫 Beautiful numbers。求区间 [a,b] 中 Beautiful numbers 的个数。分析:先分析出,2~9 的最大的最小公倍数是 2520({5,7,8,9}),先预处理出所有可能的最小公倍数m[c]dp[i][d][c]表示...
分类:
其他好文 时间:
2015-07-25 11:58:11
阅读次数:
93
1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 int gcd(int a,int b) 8 { 9 if(b==0)10 return a;11 else12 r...
分类:
其他好文 时间:
2015-07-24 16:06:26
阅读次数:
133
欢迎参加——BestCoder周年纪念赛(高质量题目+多重奖励)相遇周期Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2465Accepted S...
分类:
其他好文 时间:
2015-07-22 20:48:48
阅读次数:
138
//
// main.c
// shuzu_gongyushu
//
// Created by jereh123 on 15/7/22.
// Copyright (c) 2015年 jerehedu. All rights reserved.
//#include
//最大公约数
int getMaxCommonDivisor(int num1,int num2);...
分类:
编程语言 时间:
2015-07-22 13:14:42
阅读次数:
101
//数组枚举法
/*
==========================================================
题目:求4个数的最大公约数和最小公倍数。
==========================================================
*/...
分类:
编程语言 时间:
2015-07-22 07:00:22
阅读次数:
145
//函数调用
/*
==========================================================
题目:求4个数的最大公约数和最小公倍数。
==========================================================
*/
#include
long gys(long m,long n)
{
int ...
分类:
编程语言 时间:
2015-07-22 01:39:20
阅读次数:
201