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. golang文件上传和下载

    [代码]golang 实现的文件服务(包括上传,下载的server端和client端) (2013-09-20 02:03:52) 转载▼ 标签: golang go 文件服务器 it 分类: GO相 ...

  2. Volley框架的流程图分析

          接着上一篇Volley框架的使用,这一篇主要主要讲Volley框架运作的原理.主要使用流程图来叙述,简单的分析了整个流程的过程,具体的请参考源代码或者查看我上一篇在文章末尾添上的链接. 一 ...

  3. C++时间函数模板

    //测时间 class Timer { private: clock_t _start; clock_t _end; public: Timer() { start(); } void start() ...

  4. windows下重新安装TCP/IP协议栈

    一.windows重装TCP/IP协议     前两天在windows下安装开发环境的时候,把系统的TCP/IP协议栈给搞跪了,导致系统无法ping localhost.无法在程序中创建socket等 ...

  5. LinuxShell脚本攻略--第八章 当个好管家

    监视磁盘的使用情况 $ du file1.txt file2.txt $ du -a file_or_dir #-a递归输出指定目录的所有文件统计 $ du file_or_dir #这只是显示子目录 ...

  6. Java常见错误

    1.NullPointerExceptin 空指针异常 a.引用没有初始化就使用 b.引用置空了,仍然被使用 2.IndexOutofBoundsException 下标越界 a.数组下标小于0 或者 ...

  7. wampserver2.5 apache2.4.9:forbidden,本机可以访问,局域网内部能访问。

    wampserver2.5 apache2.4.9:forbidden,本机可以访问,局域网内部能访问. 因为做项目,多人分工,需要局域网内访问各自的项目. 然后安装了wampserver2.5,Ap ...

  8. 可视化工具之 IGV 使用方法

    整合基因组浏览器(IGV)是一种高性能的可视化工具,用来交互式地探索大型综合基因组数据.它支持各种数据类型,包括array-based的和下一代测序的数据和基因注释. IGV这个工具很牛,发了NB: ...

  9. De novo 测序基础知识

    名词解释 De novo:拉丁文,从头开始的意思,de nove测序则是指在不需要任何参考序列的情况下对某一物种进行基因组测序,然后将测得的序列进行拼接.组装,从而绘制该物种的全基因组序列图谱. 重测 ...

  10. 再说TCP神奇的40ms

    版权声明:本文由安斌原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/186 来源:腾云阁 https://www.qclou ...