HDU 3835 R(N)
R(N)
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2761 Accepted Submission(s):
1420
as x=A^2+B^2(A,B are integers). Take x=10 for example,
10=(-3)^2+1^2.
We
define R(N) (N is positive) to be the total number of variable presentation of
N. So R(1)=4, which consists of 1=1^2+0^2, 1=(-1)^2+0^2, 1=0^2+1^2,
1=0^2+(-1)^2.Given N, you are to calculate R(N).
one integer N(N<=10^9).
6
10
25
65
0
8
12
16
For the fourth test case, (A,B) can be (0,5), (0,-5), (5,0), (-5,0), (3,4), (3,-4), (-3,4), (-3,-4), (4,3) , (4,-3), (-4,3), (-4,-3)
include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
if(n==)
{
cout<<<<endl;
continue;
}
int c=sqrt(n/);
int ans=;
int i,j;
for(i=;i<=c;i++)
{
j=sqrt(n-i*i);
if(i*i+j*j==n)
{
if(i==||j==||i==j)
ans=ans+;
else
ans=ans+;
}
}
printf("%d\n",ans);
}
return ;
}
HDU 3835 R(N)的更多相关文章
- HDU 3835 R(N)(枚举)
题目链接 Problem Description We know that some positive integer x can be expressed as x=A^2+B^2(A,B are ...
- hdu 3835:R(N)(水题,数学题)
R(N) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submis ...
- H - R(N)
H - R(N) Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Sta ...
- [原]CentOS7安装Rancher2.1并部署kubernetes (二)---部署kubernetes
################## Rancher v2.1.7 + Kubernetes 1.13.4 ################ ##################### ...
- 利用python进行数据分析2_数据采集与操作
txt_filename = './files/python_baidu.txt' # 打开文件 file_obj = open(txt_filename, 'r', encoding='utf-8' ...
- Django项目:CRM(客户关系管理系统)--81--71PerfectCRM实现CRM项目首页
{#portal.html#} {## ————————46PerfectCRM实现登陆后页面才能访问————————#} {#{% extends 'king_admin/table_index.h ...
- POJ 3835 & HDU 3268 Columbus’s bargain(最短路 Spfa)
题目链接: POJ:http://poj.org/problem?id=3835 HDU:http://acm.hdu.edu.cn/showproblem.php?pid=3268 Problem ...
- hdu 4630 查询[L,R]区间内任意两个数的最大公约数
No Pain No Game Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) ...
- HDU 2031 进制转换(10进制转R进制)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2031 进制转换 Time Limit: 2000/1000 MS (Java/Others) M ...
随机推荐
- 【BZOJ-1452】Count 树状数组 套 树状数组
1452: [JSOI2009]Count Time Limit: 10 Sec Memory Limit: 64 MBSubmit: 1769 Solved: 1059[Submit][Stat ...
- 数组实现栈的结构(java)
自定义数组实现栈的结构. package test; public class MyArrayStackClient { public static void main(String[] args) ...
- Xcode的一些有用的插件
** --Alcatraz:Xcode插件管理 ** 安装:curl -fsSL https://raw.github.com/supermarin/Alcatraz/master/Scripts/ ...
- Android Studio使用教程
http://blog.csdn.net/ryantang03/article/details/8948037 http://blog.csdn.net/ryantang03/article/deta ...
- List<T> 序列化与反序列化
[Serializable] public class OrderHead { public String OrderId { get; set; } public String OrderName ...
- Why The Golden Age Of Machine Learning is Just Beginning
Why The Golden Age Of Machine Learning is Just Beginning Even though the buzz around neural networks ...
- webservice原理
webservice的工作原理 WebService的主要目标是跨平台的可互操作性.为了达到这一目标,WebService完全基于XML(可扩展标记语言).XSD(XMLSchema)等独立于平台 ...
- Socket 学习入门
http://www.codeproject.com/Articles/13071/Programming-Windows-TCP-Sockets-in-C-for-the-Begin
- tcpdump wireshark 实用过滤表达式(针对ip、协议、端口、长度和内容) 实例介绍
tcpdump wireshark 实用过滤表达式(针对ip.协议.端口.长度和内容) 实例介绍 标签: 网络tcpdst工具windowslinux 2012-05-15 18:12 3777人阅读 ...
- ExtJS学习之路第八步:Window组件
一个专门Panel用作程序窗口.默认的,Window可以是浮动的(floated).可缩放(resizable)以及可拖动的(draggable).Window能够被最大化适应可视窗口,(restor ...