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. composer 安装yii插件 fontawesome

    国外站点 http://fontawesome.io/ 国内站点 http://fontawesome.dashgame.com/ Installation The preferred way to ...

  2. php中高级基础知识点

    1. 基本知识点 HTTP协议中几个状态码的含义:1xx(临时响应) 表示临时响应并需要请求者继续执行操作的状态代码. 代码   说明 100   (继续) 请求者应当继续提出请求. 服务器返回此代码 ...

  3. vs调试 LINK : fatal error LNK1104 ...exe

    出现错误 LINK : fatal error LNK1104  ...exe (1)任务管理器中杀死...exe (2)此工程是复制过来的,但之前的已经装入内存,所以不能打开.重启VS即可.

  4. OpenCV3编程入门笔记(3)线性滤波、非线性滤波、图像深度、通道

    15     遍历图像中的像素,是先for行数后for列数的,也就是一列一列的遍历,matlab中是从1开始计数,opnecv中采用c语言的从0开始计数. 矩阵归一化:normalize()函数,参数 ...

  5. 自定义 密码是否可见 的EditView 右侧带个小眼睛

    package com.qyk.douban.widget; import android.content.Context; import android.text.Editable; import ...

  6. window2012 64bit 安装sqlserver2012 64bit调用excel的驱动安装

    如果电脑已经安装了32bit的office那么可以使用 管理员权限打开cmd,然会执行以下命令 AccessDatabaseEngine_X64.exe /passive

  7. 实现 像网易云音乐 播放列表那样的弹出型Dialog

    如图 所示是点击Test之后的 弹出的Dialog (请无视我工程的命名) 20161017/**加入点击回调,假设dialog里放了一个TextView*/ 得先写一个点击回调 public int ...

  8. OI中的代码调试

    作为一位OIer,代码调试的能力必不可少. 今天梳理一下自己进行代码调试的方法,下面只是一些个人的总结. 代码的评价有三部分: 正确性 强健性 高效性 检查也应该从这三部分出发. [正确性] 打完代码 ...

  9. C# Form内存回收

    namespace WebBrowserMemoryTest { public partial class Form1 : Form { private int _Pages; public Form ...

  10. C#运算除法和求整

    在C#与法中,“/”除后所得的值的类型,跟他的除数和被除数的类型有关.如:                        int a=4;                        int b=5 ...