这题和这题一样。。。。。。只不过多了个数。。。

Finding LCM

LightOJ - 1215

https://www.cnblogs.com/WTSRUVF/p/9316412.html

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#define rap(a, n) for(int i=1; i<=n; i++)
#define MOD 2018
#define LL long long
#define ULL unsigned long long
#define Pair pair<int, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define _ ios_base::sync_with_stdio(0),cin.tie(0)
//freopen("1.txt", "r", stdin);
using namespace std;
const int maxn = , INF = 0x7fffffff;
LL gcd(LL a, LL b)
{
return b==?a:gcd(b, a%b);
} int main()
{
int T, kase = ;
cin>> T;
while(T--)
{
LL a, b, L;
cin>> a >> b >> L;
printf("Case %d: ", ++kase);
LL c = a * b / gcd(a, b);
if(L % c)
{
cout<< "impossible" <<endl;
continue;
}
LL d = L / c;
while(gcd(c, d) != )
{
LL m = gcd(c, d);
c /= m;
d *= m;
}
cout<< d <<endl;
} return ;
}

Finding LCM LightOJ - 1215 (水题)的更多相关文章

  1. lightoj 1010 (水题,找规律)

    lightoj 1010 Knights in Chessboard 链接:http://lightoj.com/volume_showproblem.php?problem=1010 题意:国际象棋 ...

  2. Codeforces Round #356 (Div. 2)B. Bear and Finding Criminals(水题)

    B. Bear and Finding Criminals time limit per test 2 seconds memory limit per test 256 megabytes inpu ...

  3. LightOJ 1166 Old Sorting 置换群 或 贪心 水题

    LINK 题意:给出1~n数字的排列,求变为递增有序的最小交换次数 思路:水题.数据给的很小怎么搞都可以.由于坐标和数字都是1~n,所以我使用置换群求循环节个数和长度的方法. /** @Date : ...

  4. LightOJ 1065 - Number Sequence 矩阵快速幂水题

    http://www.lightoj.com/volume_showproblem.php?problem=1065 题意:给出递推式f(0) = a, f(1) = b, f(n) = f(n - ...

  5. 1215 - Finding LCM

    1215 - Finding LCM   LCM is an abbreviation used for Least Common Multiple in Mathematics. We say LC ...

  6. Lightoj 1112 - Curious Robin Hood 【单点改动 + 单点、 区间查询】【树状数组 水题】

    1112 - Curious Robin Hood PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 64 MB ...

  7. lightoj 1215

    lightoj 1215 Finding LCM 链接:http://www.lightoj.com/volume_showproblem.php?problem=1215 题意:已知 a, b, l ...

  8. LOJ Finding LCM(math)

    1215 - Finding LCM Time Limit: 2 second(s) Memory Limit: 32 MB LCM is an abbreviation used for Least ...

  9. URAL-1991 The battle near the swamp 水题

    题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1991 水题.. //STATUS:C++_AC_15MS_333KB #include ...

随机推荐

  1. d-ary heap实现一个快速的优先级队列(C#)

    d-ary heap简介: d-ary heap 是泛化版本的binary heap(d=2),d-ary heap每个非叶子节点最多有d个孩子结点. d-ary heap拥有如下属性: 类似comp ...

  2. jsp标签在JavaScript中使用时,可能会出现的一个问题。

    直接上代码 <script type="text/javascript"> var E = window.wangEditor; var editor = new E( ...

  3. 控制台报错: SCRIPT1006: Expected ')'

    今天做网站的时候,jsp页面取一个值死活取不出来. <script> if(${not empty requestScope.article.articleId}){ alert(${re ...

  4. PHP has encountered an Access Violation at 01F4A622解决方法

    php搭建的网站出现以下问题的解决方法分享: Z-blog,DedeCMS,Dsicuz!,PhpWind,PhpCMS,帝国CMS等都有可能出现php访问冲突问题. 今天访问网站发现出现了一个错误& ...

  5. c# 程序重启设定

    问题情境: 程序随着时间运行,越来越大.暂时想到的两种方法,一是反攻代码,查看占内存大的函数,是不是没有回收.再就是暴力设定程序定时重启. 解决原理: 定时重启:暂设定timer,时间匹配执行rest ...

  6. java学习de路线建议

    我想谈一谈我的一些关于网页学习的小感悟吧.之所以是写这个的原因完全是想告诉现在还处在网页学习的初始阶段的同学一些我学习走过的弯路,但我说的也仅是我个人的理解,毕竟我只能是JavaWeb开发的新手,所以 ...

  7. 第二阶段Sprint冲刺会议2

     进展:讨论主界面布局,跳转界面的布局,查看有关页面跳转的资料及示例代码并试着编写. 

  8. springmvc 映射重复

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springfr ...

  9. BATA冲刺准备

    目录 第一部分 调研,评测 福大助手的bug IOS端 Android端 福大助手结构体系的思维导图 为什么开发人员没有发现这个bug 假设团队开发这款app,应注意哪些方面(架构.部署运维.微服务等 ...

  10. flownet2.0 caffe anaconda2 编译安装

    1. 下载flownet2.0源码到指定目录 cd /home/zzq/saliency_models/deep_optical_flow git clone https://github.com/l ...