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. centos JDK安装

    第一步:查看Linux自带的JDK是否已安装 (卸载centOS已安装的1.4) 安装好的CentOS会自带OpenJdk,用命令 java -version ,会有下面的信息: java versi ...

  2. Android控件_TextView(显示文本框控件)

    一.TextView控件的常用属性  1.android:id——控件的id   2.android:layout_width——设置控件的宽度 wrap_content(包裹实际文本内容) fill ...

  3. Fatal error compiling: 无效的目标发行版: 1.8 -> [Help 1] (zhuan)

    http://blog.csdn.net/z18137017273/article/details/53033613 ***************************************** ...

  4. HTTP请求过程详解

    以请求新浪的首页为例,总结HTTP请求的流程: 步骤1:浏览器首先向服务器发送HTTP请求,请求包括: 方法:GET还是POST,GET仅请求资源,POST会附带用户数据: 路径:/full/url/ ...

  5. jsp 页面 jstl 日期的计算

    1. <% page import ="java.util.Date"%> 2. <% Date date = new Date(); date = new Da ...

  6. VC++ 中使用 std::string 转换字符串编码

    目录 第1章说明    1 1.1 代码    1 1.2 使用    4 第1章说明 VC++中宽窄字符串的相互转换比较麻烦,借助std::string能大大减少代码量. 1.1 代码 函数声明如下 ...

  7. eclipse 新建 maven 项目 添加 spring hibernate 的配置文件 详情

    主要配置文件 pom.xml 项目的maven 配置文件 管理项目所需 jar 依赖支持 web.xml 项目的总 配置文件  :添加 spring和hibernate 支持 applicationC ...

  8. Controller简介

    Controller控制器,是MVC中的部分C,为什么是部分呢?因为此处的控制器主要负责功能处理部分: 1.收集.验证请求参数并绑定到命令对象: 2.将命令对象交给业务对象,由业务对象处理并返回模型数 ...

  9. MySQL通用优化手册

    转载: MySQL通用优化手册 内容提纲 MySQL的特点: 硬件.系统优化: MySQL 配置优化: SCHEMA设计优化: SQL 优化: 其他优化. MySQL 的特点 首先,需要明确的是.想要 ...

  10. 如何使用JavaScript和正则表达式进行数据验证

    利用客户端JavaScript的优势,JavaScript中的正则表达式可以简化数据验证的工作,下面与大家分享下如何使用JavaScript和正则表达式进行数据验证,感兴趣的朋友可以参考下哈 数据验证 ...