hdu 4627 The Unsolvable Problem

时间:2022-04-20 07:30:30

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;
}