输出整数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. IVF link error错误不显示的问题

      遇到一个奇怪的问题,IVF编译链接时显示error LINK: 后面没有具体的错误信息(见后图,我的窗口后面是空的)环境:windows 10 64位系统,VS2017 commutity 版本, ...

  2. Unity2018 Shader Graph 实验室

    Unity2018 Shader Graph 实验室 Shader Shader Graph Unity  Tips: -- 在shader forge和amplyfy Shader节点图形化shad ...

  3. Netty源码分析第4章(pipeline)---->第7节: 前章节内容回顾

    Netty源码分析第四章: pipeline 第七节: 前章节内容回顾 我们在第一章和第三章中, 遗留了很多有关事件传输的相关逻辑, 这里带大家一一回顾 首先看两个问题: 1.在客户端接入的时候, N ...

  4. Django中的Project和App的区别

    Django是一个非常流行的用python编写的Web框架,在使用Django之前,我们需要了解一些基本的概念,这样可以在使用Django的时候对其有一个更加深入的把握.本文主要介绍Django中两个 ...

  5. Android工程导入Unity3D(避坑版)

    最近与各种牛逼的项目管理软件打交道,比如SourceTree,要看英文版的才看得懂,中文反而不会用!... 这篇博客适合没怎么接触过安卓的小伙伴们,网上也有很多相关的教程,但是大多都没有具体的操作或则 ...

  6. DockerCon2017前瞻 - Docker企业版体验

    DockerCon 2017将于四月17号在美国Austin召开.在去年DockerCon上,Docker公司一系列的发布吹响了进军企业市场的号角.今天,容器技术已经愈发成熟,被越来越多的企业所关注和 ...

  7. Linux常用软件安装与配置——目录

    http://blog.csdn.net/clevercode/article/details/45740431

  8. Scrum Meeting 8 -2014.11.14

    给开发加了个pdf信息提取优化任务. 弄了半天发现服务器也是个好东西.这周末可以和爬虫讨论整合的问题了. Member Today’s task Next task 林豪森 协助测试及服务器部署 协助 ...

  9. 进阶系列(12)—— C#异步编程

    一.What's 异步? 启动程序时,系统会在内存中创建一个新的进程.进程是构成运行程序资源的集合. 在进程内部,有称为线程的内核对象,它代表的是真正的执行程序.系统会在 Main 方法的第一行语句就 ...

  10. 基于MongoDB2.6版本配置MongoDB主从复制集群架构

    1:集群环境说明:mongodb1:192.168.43.10.mongodb2:192.168.43.11.mongodb3:192.168.43.12.且基于主机名相互通信/etc/hosts文件 ...