题目传送门
代码:

#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相关推荐

  1. HDU 6441 Find Integer 【费马大定理】

    传送门:HDU 6441 Find Integer Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/O ...

  2. 【2018-CCPC青岛网赛】 HDU - 6441 Find Integer

    [2018-CCPC青岛网赛] HDU - 6441 Find Integer 源链接: HDU - 6441 文源 :Blog 题意 已知等式,a^n + b ^ n = c ^ n,题目中给出 a ...

  3. 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)时 ...

  4. 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 ...

  5. 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, ...

  6. HDUOJ 6441 Find Integer

    HDUOJ 6441 Find Integer 题目链接 Problem Description people in USSS love math very much, and there is a ...

  7. 网络赛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: 在 ...

  8. 【HDU - 6441】Find Integer (费马大定理 + 奇偶数列法构造勾股定理)

    题干: people in USSS love math very much, and there is a famous math problem . give you two integers n ...

  9. 【hdu】6441 Find Integer - 费马大定理

    Find Integer 题解: 根据费马大定理很容易知道当 n>2 时,等式 a^n+b^n=c^n 是无整数解的. 再假设当 n=0 时,a^0=1.题目中说到 (1≤b,c≤1000,00 ...

最新文章

  1. python3基础知识点总结_python基础知识点总结
  2. 逆向python生成的可执行文件
  3. [操作系统]从零开始的OS
  4. sonar plugin DefaultMeasure与DefaultHighlighting
  5. 2014 网选 5011 Game(Nim游戏,数学题)
  6. js控制input只能输入数字和小数点后两位,输入其他自动清除方法。
  7. powerquery分组_Power Query 基本功能使用
  8. 树莓派开发界面显示温度_关于树莓派linux开发板
  9. linux转录组kegg注释,KEGG pathway 注释整理
  10. cpp(c++)基础
  11. 面试问题总结——关于YOLO系列(三)
  12. Pyghon文件操作
  13. 近世代数:同构、同态
  14. 补肾健脑的中药有哪些?
  15. “21 天好习惯”第一期-6
  16. 逆袭之路——python 操作数据库、SQL注入问题、索引与慢查询优化【day49】
  17. 如何将m4v视频格式快速转换成mp4视频呢
  18. 算法 - 多目标优化的注意点及常用方法概述
  19. (MATLAB)多个Excel表合成一个
  20. Activity not started, its current task has been brought to the front

热门文章

  1. 汇集了很多swift 学习指南
  2. 【蓝桥杯2019Java】平方和、最大降雨量
  3. js 数据类型之字符串
  4. Instagram 涨粉攻略2020 --我是如何7天从0到1000
  5. Vue.js 框架源码与进阶 - 搭建自己的SSR
  6. NOIP2015 pj
  7. aws课程_AWS DeepRacer,Reinforcement Learning 101和一门关于AI管治的小课程
  8. WiFi慢不一定是信号不好,这几招让你上网更顺畅
  9. 诺基亚WP7手机或10月发布 搭载新版系统
  10. 如何将chrome浏览器的默认语言改成中文呢?