hdu 4627 The Unsolvable Problem
2024-10-19 02:55:15
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;
}
最新文章
- JavaScript的一些知识碎片(2)-反射-全局变量-回调
- (转)JS中innerHTML,innerText,value
- vhosts.conf
- Codeforces Round #318 [RussianCodeCup Thanks-Round] (Div. 1) A. Bear and Poker 分解
- 【noip2012】开车旅行
- mvc Html.BeginForm 生成 ?Length=
- 纯js制作遮罩层对话框 -- g皓皓
- 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​函​数
- msyql在查询字段中的所有记录,不重复
- Express - 入门
- js中的匿名函数自执行
- SUSE(Linux操作系统)
- 一步步建立 Vue + Cesium 初始化项目
- C#中方法、类等的默认访问修饰符~
- 学习Mathematica
- xtrabackup命令用法实战(转)
- Spring MVC 全注解配置 (十一)
- oracle flashback data archive闪回数据归档天坑之XID重用导致闪回查询数据重复
- Android View 阴影的总结
- Azure CosmosDB (2) CosmosDB中的数据一致性
热门文章
- 自学EF一些小笔记
- cheat-linux命令行实用助记工具
- js知识点 知识树 知识结构 (转载 学习中)
- MVC HtmlHelper用法大全
- ajax的详细学习
- eclipse配置tomcat,访问http://localhost:8080出现404错误
- web 页面内容优化管理与性能技巧
- 转 http://www.5icool.org/a/201106/a654.html CSS开发中常用的公用样式
- Tomcat Manager用户配置详解
- 学编程,学单词.....在学习中积累自己的单词(不断更新__ing)