没心情写数学题啦啊   好难啊

#include<bits/stdc++.h>
using namespace std;
set<int> s;
set<int>::iterator it;
int main ()
{
s.clear();
for(int i=;i*i<=1e9;i++)
s.insert(i*i);
int n; scanf("%d",&n);
bool flag =;
for(int i=;i*i<=n/;i++)
{
int t = n-i*i;
if(s.find(t) != s.end())
{
flag=;
printf("%d %d\n",i,int(sqrt(t)));
}
}
if(flag ==)
puts("No Solution");
}

51nod 1080 两个数的平方和的更多相关文章

  1. 51Nod 1080 两个数的平方和(数论,经典题)

    1080 两个数的平方和 基准时间限制:1 秒 空间限制:131072 KB 分值: 5         难度:1级算法题 给出一个整数N,将N表示为2个整数i j的平方和(i <= j),如果 ...

  2. (构造)51NOD 1080 两个数的平方和

    给出一个整数N,将N表示为2个整数i与j的平方之和(i <= j),如果有多种表示,按照i的递增序输出. 例如:N = 130,130 = 3^2 + 11^2 = 7^2 + 9^2(注:3^ ...

  3. 51nod 1080:两个数的平方和

    1080 两个数的平方和 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题  收藏  关注 给出一个整数N,将N表示为2个整数i j的平方和(i <= j),如果 ...

  4. 633. Sum of Square Numbers【Easy】【双指针-是否存在两个数的平方和等于给定目标值】

    Given a non-negative integer c, your task is to decide whether there're two integers a and bsuch tha ...

  5. 51Nod 1684 子集价值 (平方和去括号技巧)

    http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1684 题意: 新建一个位运算,求所有子集通过这个位运算后的答案的平方和是 ...

  6. Java数据结构与算法之---求两个数的最大公约数(欧几里得算法)

    一个简单的小算法来获取两个数的最大公约数, public class Test { public static void main(String[] args) { long result = gcd ...

  7. JavaScript获取两个数之间的任意随机数

    通过JavaScript的Math.random()方法可以获取0到1之间的任意随机数,那如何获取任意给定的两个数之间的随机数呢?如获取2和5之间的随机数,5和10之间的随机数等. 由于Math.ra ...

  8. shell实现两个数的相加

    刚开始的时候写,一直写不对:看似简单的功能,但是一定要小心:函数的定义: funciton functionName {.....}在functionName和{之间一定有空格啊! 我就是没加空格,就 ...

  9. [猜数字]把两个数和告诉A,积告诉B,求这两个数是什么

    1-20的两个数把和告诉A,积告诉B,A说不知道是多少,B也说不知道,这时A说我知道了,B接着说我也知道了,问这两个数是多少? 分析: 设和为S,积为M. 首先,A:我不知道. 说明:S可以分解成多个 ...

随机推荐

  1. 邮件的DNS设置

    为了反垃圾,在发件人使用的域名下面最好配置两条DNS记录:SPF和DKIM,他们都是用来反垃圾的,邮件接受服务器会检查这两项,只有符合要求才会进入用户的邮箱. 一般来说,大批量发送邮件时,我们会使用第 ...

  2. mysql 操作sql语句 操作数据库

    sql语句 #1. 操作文件夹 创建数据库:create database db1 charset utf8; 查数据库:show databases; mysql> create databa ...

  3. mysql 权限管理 grant 命令

    只有root账号可以授权,其他账号不能用grant 授权 mysql> select user(); +----------------+ | user() | +--------------- ...

  4. vue中两种路由跳转拼接参数

    this.$router.push({name:"Home",query:{id:1,name:2}}) // 取到路由带过来的参数 let routerParams = this ...

  5. HDU1203:I NEED A OFFER!(01背包)

    http://acm.hdu.edu.cn/showproblem.php?pid=1203 Problem Description Speakless很早就想出国,现在他已经考完了所有需要的考试,准 ...

  6. PAT 1023 Have Fun with Numbers[大数乘法][一般]

    1023 Have Fun with Numbers (20)(20 分) Notice that the number 123456789 is a 9-digit number consistin ...

  7. 在django项目中使用django-ckeditor

    安装django-ckeditor pip install django-ckeditor 安装Pillow Pillow是python的一个图像处理库,django-ckeditor需要依赖该库.最 ...

  8. python接口自动化-参数化

    原文地址https://www.cnblogs.com/yoyoketang/p/6891710.html python接口自动化 -参数关联(一)https://www.cnblogs.com/11 ...

  9. Qt setMargin()和setSpacing() 的含义

    mainLayout=newQVBoxLayout(this); mainLayout->setMargin(30); //表示控件与窗体的左右边距 mainLayout->setSpac ...

  10. windows分区