Description

There are many unsolvable problem in the world.It could be about one or about zero.But this time it is about bigger number.
Given an integer n(2 <= n <= 10 9).We should find a pair of positive integer a, b so that a + b = n and [a, b] is as large as possible. [a, b] denote the least common multiplier of a, b.
 

Input

The first line contains integer T(1<= T<= 10000),denote the number of the test cases.
For each test cases,the first line contains an integer n.
 

Output

For each test cases, print the maximum [a,b] in a line.
 

Sample Input

3
2
3
4
 

Sample Output

1
2
3
 

#include <iostream>
#include <cstdio>
using namespace std;

int main()
{
  int t,n;
  cin>>t;
  while(t--)
   {
    cin>>n;
    if(n==2)
    {
      cout<<"1"<<endl;
      continue;
    }
    int k=n/2;
    if(n%2==1)
      printf("%I64d\n",(__int64)k*(k+1));
    else
    {
      if(k%2==1)
        printf("%I64d\n",(__int64)(k-2)*(k+2));
      else
        printf("%I64d\n",(__int64)(k-1)*(k+1));
    }
  }
  return 0;
}

 

HDU 4627 E(Contest #3)的更多相关文章

  1. HDU 4627(最小公倍数最大问题)

    HDU 4627 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u   Descript ...

  2. HDU 4627 The Unsolvable Problem 2013 Multi-University Training Contest 3

    给你一个数 n ( 2 <= n <= 109 ),现在需要你找到一对数a, b (a + b = n),并且使得LCM(a, b)尽可能的大,然后输出最大的 LCM(a, b). (为什 ...

  3. hdu 4627 The Unsolvable Problem【hdu2013多校3签到】

    链接: http://acm.hdu.edu.cn/showproblem.php?pid=4627 The Unsolvable Problem Time Limit: 2000/1000 MS ( ...

  4. hdu 4627 The Unsolvable Problem

    http://acm.hdu.edu.cn/showproblem.php?pid=4627 分类讨论一下就可以 代码: #include<iostream> #include<cs ...

  5. HDU 4627 The Unsolvable Problem(简单题)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4627 题目大意:给定一个整数n(2 <= n <= 109),满足a+b=n并且[a,b] ...

  6. HDU 5988.Coding Contest 最小费用最大流

    Coding Contest Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)To ...

  7. 2013多校联合3 G The Unsolvable Problem(hdu 4627)

    2013-07-30 20:35 388人阅读 评论(0) 收藏 举报 http://acm.hdu.edu.cn/showproblem.php?pid=4627 The Unsolvable Pr ...

  8. HDU 4627 There are many unsolvable problem in the world.It could be about one or about zero.But this time it is about bigger number.

    题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82974#problem/E 解题思路:数论,从一个数的中间开始往两边找,找到两 ...

  9. hdu 4627 The Unsolvable Problem(暴力的搜索)

    Problem Description There are many unsolvable problem in the world.It could be about one or about ze ...

随机推荐

  1. 转:Teach Yourself Programming in Ten Years——用十年教会自己编程

    转自:http://blog.csdn.net/UndeadWraith/article/details/6140455 作者:Peter Norvig 译者:刘海粟 本文原文为:http://nor ...

  2. ORACLE CentOS5.6安装

    1 准备 CentOS 5.6企业版 oracle11g fs 安装.安装环境为vmware虚拟机.另外,本安装文档非常简洁,但关键步骤都指出来了,其他的都是默认选择,遇到不知该如何选择的操作或者问题 ...

  3. aliyun CentOS6.5 上 svn 安装笔记

    为了方便管理自己的一些学习资料.总结等,在CentOS6.5上安装SVN,记录过程如下: 1.1  安装方式  独立服务器  fsfs SVN服务器有2种运行方式:独立安装.SVN+Apache.独立 ...

  4. 20160808_Linux服务

    1. http://bbs.csdn.net/topics/370100269 2. http://blog.csdn.net/csfreebird/article/details/8239933 h ...

  5. contains

    ArrayLIst类使用contains方法时要注意:放入ArrayList中的类必须要重写equals方法(既然equals重写了,那么 hash方法也应该重写,这两个方法一般同时重写):如果不重写 ...

  6. tabhost切换标签:Log中出现You must supply a layout_width attribute的解决方法

    谷歌.百度该问题,发现,除非是真的忘记添加layout_height或者layout_width属性值,对于布局文件没有语法问题但又难以发现问题所在的情况,从自己的经历和一个帖子的说明看到,该错误多半 ...

  7. 例题:打印正三角形。两层for循环,难点明白行与列的关系

    while (true)            {                string s = "★";//s代表五角星                string t = ...

  8. C/C++大数库简介

    在网络安全技术领域中各种加密解密算法的软件实现上始终有一个共同的问题就是如何在普通的PC机上实现大数的运算.我们日常生活中所应用的PC机内部字长多是32位或64位,但是在各种加密解密的算法中为了达到一 ...

  9. [myeclipse] 官方中文网站

    myeclipse官方中文网站:http://www.myeclipsecn.com/

  10. [saiku] 登陆/选择cube 时发生了什么

    一 登陆saiku时发生了什么 大致流程 saiku 默认有admin和两个开发人员的身份 登陆saiku时,后台用户认证成功后创建了用户信息session 并在session中存储了随机生成的一个s ...