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

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. [学习笔记]SiftGPU入门

    当有读者看到我这篇SiftGPU入门的学习笔记时,相信你已经读过了高博那篇<SLAM拾萃:SiftGPU>,那篇文章写于16年,已经过去两年的时间.在我尝试配置SiftGPU的环境时,遇到 ...

  2. opengl基础

    opengl opengl是一个由Khronos组织制定并维护的规范(Specification) .是一系列的图形软件编程接口,和gdi类似.opengl有很多封装的库最有名的GLFW库.接下来很多 ...

  3. spring cloud 入门系列:总结

    从我第一次接触Spring Cloud到现在已经有3个多月了,当时是在博客园里面注册了账号,并且看到很多文章都在谈论微服务,因此我就去了解了下,最终决定开始学习Spring Cloud.我在一款阅读A ...

  4. 戴尔win10重新安装win7系统

    戴尔v5468电脑win10重装回win7系统 首先是公司需要用到ie8来执行公司的项目维护,都是很早之前的项目了,因为是对接政府相关的业务,不怎么有把握对项目进行稳定更新,所以我就为这个ie8操碎了 ...

  5. 基于openvswitch+Docker构建SDN网络测试环境 (使用ovs-docker进行构建)

    这是一篇之前写的笔记,主要记录了使用openvswitch + Docker 等进行一个小型的SDN网络搭建的操作步骤.由于 之前临时有其他任务,耽搁了一下,最近开始重新整理,并计划开发一个简单的Py ...

  6. Protocol buffer的使用案例

    Protocolbuffer(以下简称PB)是google 的一种数据交换的格式,它独立于语言,独立于平台.google 提供了多种语言的实现:java.c#.c++.go 和 python,每一种实 ...

  7. SDWebImage 错误汇总

    1.  [UIImageView sd_setImageWithURL:placeholderImage:]: unrecognized selector sent to instance 打包静态库 ...

  8. 微软职位内部推荐-Software Engineer II-Senior Software Engineer for Satori

    微软近期Open的职位: Title: Software Engineer II-Senior Software Engineer for Satori, STC Location: Beijing ...

  9. Ubuntu16.04Server版离线安装Nginx1.8.1+Mysql5.7.23+Python3.6.2

    nginx1.8.1 1.安装前准备工作 1.1.检查系统版本,确认源码编译所依赖的环境,提前下载好压缩包. 整个环境都是使用root权限安装,系统版本为server版的ubuntu16.04.4 r ...

  10. centos下设置自启动和配置环境变量的方法

    1. 设置自启动 在CentOS系统下,主要有两种方法设置自己安装的程序开机启动.1.把启动程序的命令添加到/etc/rc.d/rc.local文件中,比如下面的是设置开机启动httpd. #!/bi ...