hdu 4627 The Unsolvable Problem
来源:互联网 发布:知乎 天使投资人 编辑:程序博客网 时间:2024/05/29 18:33
题目链接:点击打开链接
题目大意:给予n,找到a+b =n,并且a,b最小公倍数尽量大
题目分析:从中间向向两边找。若n为奇数,n/2和n/2+1;若为偶数,分为两种情况:1.如果n/2为奇数,则n/2+2和n/2-2,如果n/2为偶数则n/2-1和n/2+1
注意边界就行了
#include<stdio.h>#include<algorithm>#include<stdlib.h>#include<iostream>using namespace std;int main(){ int t; __int64 n,ans; scanf("%d",&t); while(t--) { scanf("%I64d",&n); if(n==2) ans=1; else { if(n%2) ans=(n/2)*(n/2+1); else { n=n/2; if(n%2) ans=(n-2)*(n+2); else ans=(n-1)*(n+1); } } printf("%I64d\n",ans); } return 0;}
- hdu - 4627 - The Unsolvable Problem
- HDU-4627-The Unsolvable Problem
- hdu 4627 The Unsolvable Problem
- HDU 4627 The Unsolvable Problem
- HDU 4627 The Unsolvable Problem 解题报告
- hdu 4627 The Unsolvable Problem (数论)
- HDU 4627 The Unsolvable Problem 数学
- hdu 4627 The Unsolvable Problem(暴力)
- HDU 4267 The Unsolvable Problem
- hdu 4627 The Unsolvable Problem 多校第三场
- hdu 4627 The Unsolvable Problem【hdu2013多校3签到】
- HDU 4691 The Unsolvable Problem 后缀数组
- 2013多校联合3 G The Unsolvable Problem(hdu 4627)
- HDOJ 4627 - The Unsolvable Problem 打表观察..
- BUCT OJ 2264: The Unsolvable Problem
- 2013 Multi-University Training Contest 3 (g) The Unsolvable Problem
- hdu 3666 THE MATRIX PROBLEM
- hdu 2058 The sum problem
- 【转】成为究极程序员的艰难的六步
- ERP收付台账
- Matlab 图像处理
- 飞思卡尔i.MX 6Quad Android 4.2.2的中兴和Ublox 3G驱动移植
- JAVA内存泄露
- hdu 4627 The Unsolvable Problem
- windows下Emacs的安装与配置
- POJ-2342-Anniversary party
- 程序猿的自我修养--链接、装载于库开头
- 50种制作图表JS库
- AVL树—平衡二叉查找树
- restrict
- Extjs4---Uncaught TypeError: Cannot call method 'hasOwnProperty' of undefined
- 二叉树