http://acm.hdu.edu.cn/showproblem.php?pid=4627

分类讨论一下就可以

代码:

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<set>
using namespace std; typedef long long ll;
typedef pair<double,double>ppd;
const double PI = acos(-1.);
const double eps = (1e-9);
const int N=2005;
const int M=2000000;
const int K=27; int main()
{
//freopen("data.in","r",stdin);
int T;
scanf("%d",&T);
while(T--)
{
ll n;
cin>>n;
if(n==2)
{cout<<"1"<<endl;continue;}
ll a=n/2;
ll b=n-a;
if(a!=b)
{cout<<(a*b)<<endl;continue;}
if((a&1)==0)
{cout<<(a-1)*(a+1)<<endl;continue;}
cout<<(a-2)*(a+2)<<endl;
}
return 0;
}

最新文章

  1. JavaScript的一些知识碎片(2)-反射-全局变量-回调
  2. (转)JS中innerHTML,innerText,value
  3. vhosts.conf
  4. Codeforces Round #318 [RussianCodeCup Thanks-Round] (Div. 1) A. Bear and Poker 分解
  5. 【noip2012】开车旅行
  6. mvc Html.BeginForm 生成 ?Length=
  7. 纯js制作遮罩层对话框 -- g皓皓
  8. S​Q​L​ ​S​e​r​v​e​r​中​​的​P​W​D​E​N​C​R​Y​P​T​与​P​W​D​C​O​M​P​A​R​E​函​数
  9. msyql在查询字段中的所有记录,不重复
  10. Express - 入门
  11. js中的匿名函数自执行
  12. SUSE(Linux操作系统)
  13. 一步步建立 Vue + Cesium 初始化项目
  14. C#中方法、类等的默认访问修饰符~
  15. 学习Mathematica
  16. xtrabackup命令用法实战(转)
  17. Spring MVC 全注解配置 (十一)
  18. oracle flashback data archive闪回数据归档天坑之XID重用导致闪回查询数据重复
  19. Android View 阴影的总结
  20. Azure CosmosDB (2) CosmosDB中的数据一致性

热门文章

  1. 自学EF一些小笔记
  2. cheat-linux命令行实用助记工具
  3. js知识点 知识树 知识结构 (转载 学习中)
  4. MVC HtmlHelper用法大全
  5. ajax的详细学习
  6. eclipse配置tomcat,访问http://localhost:8080出现404错误
  7. web 页面内容优化管理与性能技巧
  8. 转 http://www.5icool.org/a/201106/a654.html CSS开发中常用的公用样式
  9. Tomcat Manager用户配置详解
  10. 学编程,学单词.....在学习中积累自己的单词(不断更新__ing)