题意:给定n,求x,y,z三个整数,使得x|n,y|n,z|n,且xyz最小

n<=1e6

思路:

不定方程1/x+1/y+1/z=1

只有(2,3,6)(2,4,4) (3,3,3)三组正整数解

设x<=y<=z,x=2或3

x=2时1/y+1/z=1/2,y=3或4时存在z

x=3时1/y+1/z=2/3,y=3时存在z

只有这三种情况

 #include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<cstring>
using namespace std;
int cas;
long long ans,n; int main()
{
// freopen("1001.in","r",stdin);
// freopen("1001.out","w",stdout);
scanf("%d",&cas);
for(int i=;i<=cas;i++)
{
scanf("%lld",&n);
ans=-;
if(!(n%)) ans=n/*n/*n/;
if(!(n%)) ans=n/*n/*n/;
if(!(n%)) ans=n/*n/*n/;
printf("%lld\n",ans);
}
return ;
}

【HDOJ6298】Maximum Multiple(数论)的更多相关文章

  1. hdu 6298 Maximum Multiple (简单数论)

    Maximum Multiple Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  2. HDU 多校对抗赛 A Maximum Multiple

    Maximum Multiple Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  3. HDU6298 Maximum Multiple (多校第一场1001)

    Maximum Multiple Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  4. hdu 6298 Maximum Multiple(规律)

    hdu6298 Maximum Multiple 题目传送门 题意: 给你一个整数n,从中找出可以被n整除的三个数x,y,z: 要求x+y+z=n,且x*y*z最大. 思路: 开始一看T到1e6,n也 ...

  5. 数学--数论--HDU-2698 Maximum Multiple(规律)

    Given an integer nn, Chiaki would like to find three positive integers xx, yy and zzsuch that: n=x+y ...

  6. 数学--数论-- HDU6298 Maximum Multiple 打表找规律

    Given an integer nn, Chiaki would like to find three positive integers xx, yy and zzsuch that: n=x+y ...

  7. HDU_6298 Maximum Multiple 【找规律】

    一.题目 Given an integer $n$, Chiaki would like to find three positive integers $x$, $y$ and $z$ such t ...

  8. 2018HDU多校训练一 A - Maximum Multiple

    Given an integer nn, Chiaki would like to find three positive integers xx, yy and zzsuch that: n=x+y ...

  9. 「日常训练」Maximum Multiple(HDU-6298)

    题意与分析 一开始以为是一条高深的数学题,跳过去了,后来查其他题目的代码的时候无意看到,一看emmmmmm 稍微思考一下就有了.\(1=\frac{1}{3}+\frac{1}{3}+\frac{1} ...

随机推荐

  1. 使用ant build build.xml报“includeantruntime was not set”警告及"Class not found: javac1.8"问题

    问题1:ant编译build.xml报“includeantruntime was not set”警告. 警告详情: warning: 'includeantruntime' was not set ...

  2. [转]FaceBook ATC 弱网测试工具环境搭建

    工具简介 ATC是FaceBook开源的移动网络测试工具Augmented Traffic Control(ATC),能够方便的让我们模拟各种网络环境进行测试. ATC有两个最吸引人的特点: 在手机上 ...

  3. ES之基本数据类型之间的显示转换和隐式转换

    typeof(数据)/ typeof 数据 判断数据的数据类型,typeof返回的都是字符串 输出结果类型有:number.string.boolean. undefined.object.funct ...

  4. jsapi4加载的首个图层的范围被默认作为地图范围,且不能修改的解决

    在map加载的第一个图层的图层范围(fullExtent),会被默认设置为map的全图范围,且不能更改,从一般地图控件角度来说,应该有fullExtent属性,作为地图的全图范围,但很遗憾jsapi4 ...

  5. sql语句分为三类(DML,DDL,DCL)-介绍

    本文知识来源自:<Oracle专家高级编程> 分享作者:Vashon 时间:20150415 DDL is Data Definition Language statements. Som ...

  6. ubuntu下安装apcu扩展

    apcu前身是apc,apc分为系统缓存和用户缓存 1.系统缓存是指PHP执行时增加缓存,减少PHP文件的反复检查和编译,从而达到系统加速的目的. 2.用户缓存是指,PHP代码中将数据写入缓存,是用户 ...

  7. TFS2010单独安装配置tfs build server

    记录一下确实很磨人. 同样硬件和软件环境的两台服务器,其中一台服务器很久之前就配置好了tfs2010 build ,然后最近想再配置一台tfs build server,但是按照以前的配置流程始终提示 ...

  8. Struts2 前端与后台之间传值问题

    老是被前端与后台之间的传值给弄糊涂了,特此写一篇blog进行总结. 一. 前端向后台传值 (1)属性驱动 属性驱动是指在Action类里,包含表单里对应的字段(字段名称一样),同时设置对应的gette ...

  9. 【前端】pid2children iview tree json

    <script> import inBody from '../inBody' export default { components:{ inBody } ,data () { retu ...

  10. 无法读取配置节"system.web.extensions",因为它缺少节声明

    设置 .Net Framework版本 v2.0.50727 要设置成 v4.0.30319