D - Find Integer

$a^{n}+b^{n}=c^{n}$

给定a,n求解$b,c$

三次以上没有整数解

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll A[];
ll n,a;
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
scanf("%lld%lld",&n,&a); if(n>=)
{
puts("-1 -1");
}
else if(n==)
{
cout<<<<' '<<a+<<'\n';
}
else if(n==)
{
cout<<-<<' '<<-<<'\n';
}
else
{
ll b,c,x,y;
for(ll i=; i<a; i++)
{
if((a*a)%i==)
{
x=(a*a)/i;
y=i;
// cout<<(x+y)<<" "<<a<<endl;
if((x+y)%==&&(x+y)!=(*a))break;
}
}
c=(x+y)/;
b=sqrt(c*c-a*a);
cout<<b<<' '<<c<<'\n';
}
}
}

D - Find Integer的更多相关文章

  1. LeetCode 7. Reverse Integer

    Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 Have you ...

  2. Integer.parseInt 引发的血案

    Integer.parseInt 处理一个空字符串, 结果出错了, 程序没有注意到,搞了很久, 引发了血案啊!! 最后,终于 观察到了, 最后的部分: Caused by: java.lang.NoC ...

  3. 由一个多线程共享Integer类变量问题引起的。。。

    最近看到一个多线程面试题,有三个线程分别打印A.B.C,请用多线程编程实现,在屏幕上循环打印10次ABCABC- 看到这个题目,首先想到的是解决方法是定义一个Integer类对象,初始化为0,由3个线 ...

  4. [LeetCode] Integer Replacement 整数替换

    Given a positive integer n and you can do operations as follow: If n is even, replace n with n/2. If ...

  5. [LeetCode] Integer Break 整数拆分

    Given a positive integer n, break it into the sum of at least two positive integers and maximize the ...

  6. [LeetCode] Integer to English Words 整数转为英文单词

    Convert a non-negative integer to its english words representation. Given input is guaranteed to be ...

  7. [LeetCode] Roman to Integer 罗马数字转化成整数

    Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 t ...

  8. [LeetCode] Integer to Roman 整数转化成罗马数字

    Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 t ...

  9. [LeetCode] String to Integer (atoi) 字符串转为整数

    Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. ...

  10. [LeetCode] Reverse Integer 翻转整数

    Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 click to ...

随机推荐

  1. 20191127 Spring Boot官方文档学习(4.14-4.17)

    4.14.使用RestTemplate调用REST服务 如果需要从应用程序调用远程REST服务,则可以使用Spring Framework的RestTemplate类.由于RestTemplate实例 ...

  2. Nginx 1.相关介绍

    转 https://www.cnblogs.com/wcwnina/p/8728391.html Nginx的产生 没有听过Nginx?那么一定听过它的"同行"Apache吧!Ng ...

  3. 「POI2010」反对称 Antisymmetry (manacher算法)

    # 2452. 「POI2010」反对称 Antisymmetry [题目描述] 对于一个 $0/1$ 字符串,如果将这个字符串 $0$ 和 $1$ 取反后,再将整个串反过来和原串一样,就称作「反对称 ...

  4. ISC2016训练赛 phrackCTF--Smali

    测试文件:https://static2.ichunqiu.com/icq/resources/fileupload/phrackCTF/REVERSE/Crackme.smali 参考资料:http ...

  5. Zabbix--04 自定义模版、web监控

    目录 一.自定义模版 1.创建模版 2.导出模版 3.监控TCP11种状态 3.2.重启zabbix-agent 3.3.测试监控项 4.导入模版文件 5.主机关联模版文件 6.查看最新数据 7.查看 ...

  6. Navicat连接阿里云服务器MSQL数据库

    新买了台服务器Navicat老是连接不上数据库,查找一圈找到解决办法.So Easy 一.shell远程登录,进入数据库 mysql -uroot -p 二.输入以下命令进行授权: GRANT ALL ...

  7. Python自动化学习--鼠标和键盘事件

    from selenium import webdriver from selenium.webdriver import ActionChains import time driver = webd ...

  8. 通过关键字Event定义用户自己的事件

    Event 语句 定义用户自定义的事件. 语法[Public] Event procedurename [(arglist)] Event 语句包含下面部分: 部分 描述 Public 可选的.指定该 ...

  9. vim 修改复制过来的代码缩进

    命令模式下 :1,9<  //1至9行回退一个tab :1,9> //1至9行缩进一个tab 让不可打印字符心事出来::set list

  10. Python核心技术与实战——三|字符串

    一.字符串基础 Python的字符串支持单引号('').双引号("")和三引号之中('''....'''和"""...""&quo ...