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
解题思路:数论,从一个数的中间开始往两边找,找到两个互质的数就是,若这个数为奇数,则就是(n/2)*(n-n/2),若这个数是偶数,则还需要判断这个数的一半是否是偶数,若是偶数,则就是(n/2+1)*(n/2-1),若是奇数,则就是(n/2+2)*(n/2-2)
程序代码:
#include <iostream>
#define l long long
using namespace std; int main()
{
l t;cin>>t;
while(t--)
{ l n;
cin>>n;
if(n==)
cout<<<<endl;
else
{
if(n%)
cout<<(n/)*(n/+)<<endl;
else
{
if((n/)%)
cout<<(n/+)*(n/-)<<endl;
else
cout<<(n/+)*(n/-)<<endl;
}
}
}
return ;
}
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.的更多相关文章
- 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 ...
- hdu 4627 The Unsolvable Problem【hdu2013多校3签到】
链接: http://acm.hdu.edu.cn/showproblem.php?pid=4627 The Unsolvable Problem Time Limit: 2000/1000 MS ( ...
- hdu 4627 The Unsolvable Problem(暴力的搜索)
Problem Description There are many unsolvable problem in the world.It could be about one or about ze ...
- HDU 4627(最小公倍数最大问题)
HDU 4627 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Descript ...
- HDU 4627 E(Contest #3)
Description There are many unsolvable problem in the world.It could be about one or about zero.But t ...
- The Unsolvable Problem
The Unsolvable Problem 题目链接:http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=45783 题意: ...
- hdu 4972 A simple dynamic programming problem(高效)
pid=4972" target="_blank" style="">题目链接:hdu 4972 A simple dynamic progra ...
- hdu 4627 The Unsolvable Problem
http://acm.hdu.edu.cn/showproblem.php?pid=4627 分类讨论一下就可以 代码: #include<iostream> #include<cs ...
- HDU 4627 The Unsolvable Problem(简单题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4627 题目大意:给定一个整数n(2 <= n <= 109),满足a+b=n并且[a,b] ...
随机推荐
- HDFS Users Guide--官方文档
HDFS Users Guide Purpose Overview Prerequisites Web Interface Shell Commands DFSAdmin Command Second ...
- sublime text3 插件配置
(转) sublme text 全程指引:http://www.cnblogs.com/figure9/p/sublime-text-complete-guide.html 使用Package Con ...
- SPOJ 181 - Scuba diver 二维背包
潜水员要潜水,给出n个气缸(1<=n<=1000),每个气缸中有氧气量为ti,氮气量为ai,气缸重量为wi(1<=ti<=21,1<=ai<=79,1<=wi ...
- 解决SQL Server的TEXT、IMAGE类型字段的长度限制
更多资讯.IT小技巧.疑难杂症等等可以关注 艾康享源 微信公众号. 来自为知笔记(Wiz)
- cocopods安装
CocoaPods安装和使用教程 Code4App 原创文章.转载请注明出处:http://code4app.com/article/cocoapods-install-usage 目录 CocoaP ...
- 使用Eclipse创建Hibernate工程
创建一个java project项目,加入hibernate的jar包和数据库驱动包,并引入到项目.
- Qt中如何在QCursor移动的时候不触发moveEvent
有时候有这样的需求,比如想对全局光标进行一次setPos(),但这个时候又不想触发消息队列触发mouseMoveEvent,这个时候就可以这么做. myWidget->clearFocus(); ...
- TCP/IP-入门
Life is not a rehearsal "人生没有彩排" 参考资料:TCP/IP入门经典 (第五版) TCP/IP详解 卷一:协议 一.什么是TCP/IP TCP/IP是一 ...
- hdu 1241 Oil Deposits(DFS求连通块)
HDU 1241 Oil Deposits L -DFS Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & ...
- ServiceStack.OrmLite
ServiceStack.OrmLite 谈谈我的入门级实体框架Loogn.OrmLite 每次看到有新的ORM的时候,我总会留意一下,因为自己也写过一个这样的框架,人总是有比较之心的.我可能会d ...