hdu 3835:R(N)(水题,数学题)
R(N)
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1815    Accepted Submission(s): 929
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).
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 <stdio.h>
#include <cmath>
using namespace std; int main()
{
int n;
while(scanf("%d",&n)!=EOF){
int sum = ;
for(int i=;i<=sqrt(n);i++){
int j = n-i*i;
double t = sqrt(j);
if(t-int(t)==){ //开方成功
if(i!= && j!=)
sum+=;
else if(i== || j==)
sum+=;
}
}
printf("%d\n",sum);
}
return ;
}
Freecode : www.cnblogs.com/yym2013
hdu 3835:R(N)(水题,数学题)的更多相关文章
- HDU 4950 Monster (水题)
		Monster 题目链接: http://acm.hust.edu.cn/vjudge/contest/123554#problem/I Description Teacher Mai has a k ... 
- HDU 4593 H - Robot 水题
		H - RobotTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ... 
- hdu 1106:排序(水题,字符串处理 + 排序)
		排序 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissi ... 
- HDU 4813 Hard Code 水题
		Hard Code Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ... 
- HDOJ/HDU 2560 Buildings(嗯~水题)
		Problem Description We divide the HZNU Campus into N*M grids. As you can see from the picture below, ... 
- HDOJ(HDU) 1859 最小长方形(水题、、)
		Problem Description 给定一系列2维平面点的坐标(x, y),其中x和y均为整数,要求用一个最小的长方形框将所有点框在内.长方形框的边分别平行于x和y坐标轴,点落在边上也算是被框在内 ... 
- HDU - 1716 排列2  水题
		排列2 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submis ... 
- HDU—2021-发工资咯(水题,有点贪心的思想)
		作为杭电的老师,最盼望的日子就是每月的8号了,因为这一天是发工资的日子,养家糊口就靠它了,呵呵 但是对于学校财务处的工作人员来说,这一天则是很忙碌的一天,财务处的小胡老师最近就在考虑一个问题:如果每 ... 
- HDU 3835 R(N)
		R(N) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submis ... 
随机推荐
- 二维纹理 Texture 2D
			Textures bring your Meshes, Particles, and interfaces to life! They are image or movie files that yo ... 
- ZOJ 2604 Little Brackets DP
			DP: 边界条件:dp[0][j] = 1 递推公式:dp[i][j] = sum{dp[i-k][j] * dp[k-1][j-1] | 0<k≤i} i对括号深度不超过j的,能够唯一表示为( ... 
- Oracle中查询某字段不为空或者为空的SQL语句怎么写
			比如 insert into table a (a1,b1)values("a1",''); 对于这种情况,因为表里存的是'',其实是没有内容的,要查询这个字段,不能直接使用 se ... 
- Mybatis 插入后返回数据库自动增长ID
			MySQL和MSSQL返回主键方法 在personMap.xml中 <insert id="addPerson" parameterType="orm.Person ... 
- mybatis加入条件
			根据http://www.cnblogs.com/friends-wf/p/3799315.html搭建的环境 User.xml加入的 if where判断的 <!-- 根据条件查询一个用户 - ... 
- 安装应用程序 报“ 997 重叠 I/O 操作在进行中”错解决办法
			解决办法: 原因: Per Microsoft's blog, patch KB2918614 appears to have caused installation issues 按照微软的博客,补 ... 
- sql server xtype 对应数据类型名称sql查询
			SELECT c.name,c.user_type_id,t.name FROM sys.[columns] AS c INNER JOIN sys.types AS t ON t.user_type ... 
- 从1KW条数据中筛选出1W条最大的数
			using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using S ... 
- etymology-F
			forsake [fə'seɪk] vt.放弃:断念. watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400 ... 
- PHP 时间与日期
			PHP提供了大量的内置函数,使开发者在时间的处理上游刃有余,大大提高了工作效率. 介绍一些常见的PHP日期和时间函数以及日期和时间的处理. 经常使用的日期和时间处理函数 函 数 说 明 checkd ... 
