Finding LCM LightOJ - 1215 (水题)
这题和这题一样。。。。。。只不过多了个数。。。
Finding LCM
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 (水题)的更多相关文章
- lightoj 1010 (水题,找规律)
lightoj 1010 Knights in Chessboard 链接:http://lightoj.com/volume_showproblem.php?problem=1010 题意:国际象棋 ...
- 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 ...
- LightOJ 1166 Old Sorting 置换群 或 贪心 水题
LINK 题意:给出1~n数字的排列,求变为递增有序的最小交换次数 思路:水题.数据给的很小怎么搞都可以.由于坐标和数字都是1~n,所以我使用置换群求循环节个数和长度的方法. /** @Date : ...
- LightOJ 1065 - Number Sequence 矩阵快速幂水题
http://www.lightoj.com/volume_showproblem.php?problem=1065 题意:给出递推式f(0) = a, f(1) = b, f(n) = f(n - ...
- 1215 - Finding LCM
1215 - Finding LCM LCM is an abbreviation used for Least Common Multiple in Mathematics. We say LC ...
- Lightoj 1112 - Curious Robin Hood 【单点改动 + 单点、 区间查询】【树状数组 水题】
1112 - Curious Robin Hood PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 64 MB ...
- lightoj 1215
lightoj 1215 Finding LCM 链接:http://www.lightoj.com/volume_showproblem.php?problem=1215 题意:已知 a, b, l ...
- LOJ Finding LCM(math)
1215 - Finding LCM Time Limit: 2 second(s) Memory Limit: 32 MB LCM is an abbreviation used for Least ...
- URAL-1991 The battle near the swamp 水题
题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1991 水题.. //STATUS:C++_AC_15MS_333KB #include ...
随机推荐
- JAVA的关键特性
Java团队对设计Java时的关键考虑因素进行了总结,关键特性包含以下列表: 简单性 安全性 可移植性 面向对象 健壮性 多线程 体系结构中立 解释执行 高性能 分布式 动态性 简单性 Java的设计 ...
- Qt 利用XML文档,写一个程序集合 四
接上一篇https://www.cnblogs.com/DreamDog/p/9214067.html 启动外部程序 这里简单了,直接上代码吧 connect(button,&MPushBut ...
- 关于dbw 与dbm 的计算
一分贝(dB)表示单元信号强度的相对差异.其比率的基础对数为10,,如dB = 10 x Log10 (P1/P2). 基础10对数规则: Log10 (AxB) = Log10(A) + Log10 ...
- Unity优化方向——优化Unity游戏中的脚本(译)
原文地址:https://unity3d.com/cn/learn/tutorials/topics/performance-optimization/optimizing-scripts-unity ...
- SpringCloud使用Feign出现java.lang.ClassNotFoundException: org.springframework.cloud.client.loadbalancer.LoadBalancedRetryFactory异常
废话不多说!!! 在SpringCloud项目中配置了Feign来调用restful接口,项目启动的时候报错,报错信息如下: 找不到org.springframework.cloud.client.l ...
- vue 自定义全局按键修饰符
在监听键盘事件时,我们经常需要检查常见的键值.Vue 允许为 v-on 在监听键盘事件时添加按键修饰符: JS部分: Vue.config.keyCodes = { f2:113, } var app ...
- ngxin 添加模块
if test -n "$NGX_ADDONS"; then echo configuring additional modules for ngx_addon_dir in $N ...
- Python-opencv摄像头图像捕获
实例一 (灰色调度) #!/usr/bin/env python # _*_ coding:utf-8 _*_ import cv2 as cv import numpy as np capture ...
- OGG 跳过事务(转)
http://blog.chinaunix.net/uid-26190993-id-3434074.html 在OGG运行过程中,通常会因为各种各样的原因导致容灾端的REPLICAT进程ABEN ...
- JSBridge实现示例
前言 参考来源 前人栽树,后台乘凉,本文参考了以下来源 Hybrid APP架构设计思路 marcuswestin/WebViewJavascriptBridge 楔子 本文介绍JSBridge的完整 ...