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 ...
随机推荐
- Style对象之一
<html> <style type="text/css"> body{ background-color="#FFCC80"; bac ...
- 在xcode5下利用Source Control 做 git 项目管理
xcode5做了很大的更新,其中一点非常实用的功能是集成了Source control项目管理,而且和git做了完美的结合:非常实用: 使用: 在新建项目时,选择 下面的 Create a git r ...
- Bitmap和Drawable的互相转换
刚好之前的项目实用到.怕遗忘了.就先记录下来.然后会用到的时候直接来这copy使用就好了. 1.Bitmap ---->Drawable: public static Drawable bitm ...
- 运行maven pom.xml文件后编译环境变为jdk1.5
idea中运行pom.xml文件后,将编译环境变成了1.5,造成一系列的编译问题很是不方便. 以下是解决方法: 在"pom.xml"里加入如下代码: <properties& ...
- 全排列算法 --javascript 实现
var Ann = function a(arr){ if(arr.length == 1){return arr;} var rr = new Array(); for(var i = 0; i&l ...
- 学会Git玩转Github笔记(三)—— Github Pages 搭建个人网站
https://help.github.com/categories/github-pages-basics/ 一.个人站点 访问 https://用户名.github.io 搭建步骤 1) 创建个人 ...
- CSS经验库
1.兼容360浏览器 字体大小设置 开发中需要使用em单位 font-size: 0.83em; font-family: "Arial"; -webkit-text-size-a ...
- Android中的倒计时实现
一.android.os包下提供了倒计时的抽象工具类: public abstract class CountDownTimer { /** * Millis since epoch when ala ...
- sublime for mac 注册码
https://www.jianshu.com/p/04e1b65dd2c0https://fatesinger.com/100121
- Team Foundation Server安装指南(转载)
1.说明 Team Foundation Server(以下简称VSTF)的安装并不是一件轻松的事情,在安装的过程中相信很多人都或多或少碰到一些问题而安装不成功,虽然手头有微软提供的所谓安装手册,也曾 ...