HDU 6441 Find Integer
题目传送门
代码:
#include<bits/stdc++.h>
using namespace std;int main(){int T;scanf("%d",&T);while(T--){int n,a;scanf("%d%d",&n,&a);if(n==0 || n>2) printf("-1 -1\n");else{if(n==1) printf("%d %d\n",a,2*a);else{if(a%2){ //c%2!=b%2int c=(a*a+1)/2;int b=c-1;printf("%d %d\n",b,c);}else{ //c%2==b%2int c=a*a/4+1;int b=c-2;printf("%d %d\n",b,c);}}}}
}
HDU 6441 Find Integer相关推荐
- HDU 6441 Find Integer 【费马大定理】
传送门:HDU 6441 Find Integer Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/O ...
- 【2018-CCPC青岛网赛】 HDU - 6441 Find Integer
[2018-CCPC青岛网赛] HDU - 6441 Find Integer 源链接: HDU - 6441 文源 :Blog 题意 已知等式,a^n + b ^ n = c ^ n,题目中给出 a ...
- hdu.6441 Find Integer
hdu.6441 Find Integer 思路:费马大定理+勾股定理. 费马大定理内容:an+bn=cn,(n>2)a^n+b^n=c^n,(n>2)an+bn=cn,(n>2)时 ...
- HDU 6441 Find Integer(费马大定理)
people in USSS love math very much, and there is a famous math problem . give you two integers n,a,y ...
- HDU 6441 Find Integer(数论)
Description 给出n,an,an,a,求一组b,cb,cb,c使得an+bn=cna^n+b^n=c^nan+bn=cn Input 第一行一整数TTT表示用例组数,每组用例输入两个整数n, ...
- HDUOJ 6441 Find Integer
HDUOJ 6441 Find Integer 题目链接 Problem Description people in USSS love math very much, and there is a ...
- 网络赛1-D - Find Integer HDU - 6441
题目链接http://acm.hdu.edu.cn/showproblem.php?pid=6441 费马定理,大于2是无解的 n=2时 当a是偶数时,b与c相差2: 当a是奇数时,b与c相差1: 在 ...
- 【HDU - 6441】Find Integer (费马大定理 + 奇偶数列法构造勾股定理)
题干: people in USSS love math very much, and there is a famous math problem . give you two integers n ...
- 【hdu】6441 Find Integer - 费马大定理
Find Integer 题解: 根据费马大定理很容易知道当 n>2 时,等式 a^n+b^n=c^n 是无整数解的. 再假设当 n=0 时,a^0=1.题目中说到 (1≤b,c≤1000,00 ...
最新文章
- python3基础知识点总结_python基础知识点总结
- 逆向python生成的可执行文件
- [操作系统]从零开始的OS
- sonar plugin DefaultMeasure与DefaultHighlighting
- 2014 网选 5011 Game(Nim游戏,数学题)
- js控制input只能输入数字和小数点后两位,输入其他自动清除方法。
- powerquery分组_Power Query 基本功能使用
- 树莓派开发界面显示温度_关于树莓派linux开发板
- linux转录组kegg注释,KEGG pathway 注释整理
- cpp(c++)基础
- 面试问题总结——关于YOLO系列(三)
- Pyghon文件操作
- 近世代数:同构、同态
- 补肾健脑的中药有哪些?
- “21 天好习惯”第一期-6
- 逆袭之路——python 操作数据库、SQL注入问题、索引与慢查询优化【day49】
- 如何将m4v视频格式快速转换成mp4视频呢
- 算法 - 多目标优化的注意点及常用方法概述
- (MATLAB)多个Excel表合成一个
- Activity not started, its current task has been brought to the front