输出整数N,使得  t1 <= N  统计有多少组t1,t2,t3,满足:1<t1<t2<t3<=1000000,t3-t1<=25,且t1,t2,t3的最小公倍数是N

枚举t1就好了

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#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 = ; LL gcd(LL a, LL b)
{
return b==?a:gcd(b, a%b);
} int main()
{
LL n;
int kase = ;
while(scanf("%lld",&n) != EOF && n)
{
int ok = ;
printf("Scenario %d:\n",++kase);
for(LL i=; i<=n && i<=maxn; i++)
{
if(n % i) continue;
for(LL j=i+; j<=i+ && j<=maxn; j++)
{
if(n % j) continue;
LL tem1 = i * j / gcd(i, j);
for(LL k=j+; k<=i+ && k <= maxn; k++)
{
if(n % k) continue;
LL tem2 = tem1 * k / gcd(tem1, k);
if(tem2 == n)
{
printf("%lld %lld %lld\n",i,j,k);
ok = ;
}
}
}
}
if(!ok) printf("Such bells don't exist\n"); printf("\n"); } return ;
}

The Bells are Ringing UVALive - 4060(枚举求解)的更多相关文章

  1. The Bells are Ringing(枚举)

    Description Perhaps you all have heard the mythical story about Tower of Hanoi (The details of this ...

  2. UVA - 12119 The Bells are Ringing (枚举)

    Perhaps you all have heard the mythical story about Tower of Hanoi (The details of this story is not ...

  3. zoj 1008 暴力枚举求解dfs+优化

    /* 现将相同的合并计数. 再枚举判断是否符合当cou==n*n是符合就退出 */ #include<stdio.h> #include<string.h> #define N ...

  4. POJ1288 Sly Number(高斯消元 dfs枚举)

    由于解集只为{0, 1, 2}故消元后需dfs枚举求解 #include<cstdio> #include<iostream> #include<cstdlib> ...

  5. poj 2992 Divisors (素数打表+阶乘因子求解)

    Divisors Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9617   Accepted: 2821 Descript ...

  6. Avito Cool Challenge 2018 E. Missing Numbers 【枚举】

    传送门:http://codeforces.com/contest/1081/problem/E E. Missing Numbers time limit per test 2 seconds me ...

  7. .Uva&LA部分题目代码

    1.LA 5694 Adding New Machine 关键词:数据结构,线段树,扫描线(FIFO) #include <algorithm> #include <cstdio&g ...

  8. [学习笔记] 舞蹈链(DLX)入门

    "在一个全集\(X\)中若干子集的集合为\(S\),精确覆盖(\(\boldsymbol{Exact~Cover}\))是指,\(S\)的子集\(S*\),满足\(X\)中的每一个元素在\( ...

  9. Beauty Contest

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=28417#problem/F 题目大意:给n个点,求相聚最远距离的平方(输出整形) 集体思 ...

随机推荐

  1. 【转载】钉钉开发c#帮助类 获取用户信息 DingHelper.cs

    using System;using System.Collections.Generic;using System.Configuration;using System.Linq;using Sys ...

  2. Unity优化方向——优化Unity游戏中的垃圾回收(译)

    介绍 当我们的游戏运行时,它使用内存来存储数据.当不再需要该数据时,存储该数据的内存将被释放,以便可以重用.垃圾是用来存储数据但不再使用的内存的术语.垃圾回收是该内存再次可用以进行重用的进程的名称. ...

  3. SQL Server复制

    SQL Server复制的阶梯:级别1-SQL Server复制介绍 By Sebastian Meine, 2012/12/26 原文链接:http://www.sqlservercentral.c ...

  4. Vue Cli 中使用 Karma / Chrome 执行样式相关单元测试

    在 GearCase 开源项目 中,我使用了 Vue Cli 的默认测试框架.因此和样式相关的东西,都无法进行测试.因为它并不类似于无头浏览器,而是存在于虚拟内存之中. 现状 在如下 button.s ...

  5. 如何在window服务器上搭建一个能代替ftp的传输工具

    通常对于服务器上的文件管理和数据传输都是利用ftp来实现,但随着存储技术的发展,数据资产的存储规模和复杂程度不断提高,传统的ftp传输显得有笨重.今天给大家介绍一款能够取代ftp的在线文档管理软件—— ...

  6. etcd集群证书安装过程一

    为确保安全,kubernetes 系统各组件需要使用 x509 证书对通信进行加密和认证. CA (Certificate Authority) 是自签名的根证书,用来签名后续创建的其它证书. 本文档 ...

  7. zookeeper_节点数据版本号问题

    转自:Simba_cheng 更新节点数据的方法: 同步方法:Stat setData(final String path, byte data[], int version) 异步方法:void s ...

  8. groupadd命令详解

    基础命令学习目录首页 原文链接:https://wtj6891.iteye.com/blog/2096076 groupadd创建组群 使用groupadd命令可以在系统中创建组群账户 语法: gro ...

  9. 第三周vim入门学习2

    一.vim重复命令 1.重复执行上次命令 在普通模式下.(小数点)表示重复上一次的命令操作 拷贝测试文件到本地目录 $ cp /etc/protocols . 打开文件进行编辑 $ vim proto ...

  10. slf4j+log4j的初次使用

    关于这两者的组合应用带来的好处,google都有 就不说了. 首先说下配置, 工作笔记:在myeclipse 中创建一个java project 创建一个 TestSlf4J 类 package co ...