hdu 2058 The sum problem(数学题)
一个数学问题:copy了别人的博客
#include<cstdio>
#include<cstdlib>
#include<cmath>
int main()
{
int n,m,i,j;
while(~scanf("%d%d",&n,&m))
{
for( j=(int)sqrt(2*m); j>=1;j--)
{
i= (2*m/j-j+1)/2;
if((i*2-1+j)*j == 2*m && i+j-1 <= n)
printf("[%d,%d]\n",i,i+j-1);
} printf("\n");
}
return 0;
}
hdu 2058 The sum problem(数学题)的更多相关文章
- HDU 2058 The sum problem 数学题
解题报告:可以说是一个纯数学题,要用到二元一次和二元二次解方程,我们假设[a,b]这个区间的所有的数的和是N,由此,我们可以得到以下公式: (b-a+1)*(a+b) / 2 = N;很显然,这是一个 ...
- HDU 2058 The sum problem(枚举)
The sum problem Problem Description Given a sequence 1,2,3,......N, your job is to calculate all the ...
- 题解报告:hdu 2058 The sum problem
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2058 问题描述 给定一个序列1,2,3,...... N,你的工作是计算所有可能的子序列,其子序列的总 ...
- hdu 2058 The sum problem(简单因式分解,,)
Problem Description Given a sequence 1,2,3,......N, your job is to calculate all the possible sub-se ...
- HDU 2058 The sum problem
传送门 Description Given a sequence 1,2,3,......N, your job is to calculate all the possible sub-sequen ...
- HDU - 2058 The sum problem(思路题)
题目: Given a sequence 1,2,3,......N, your job is to calculate all the possible sub-sequences that the ...
- HDU 2058 The sum problem (数学+暴力)
题意:给定一个N和M,N表示从1到N的连续序列,让你求在1到N这个序列中连续子序列的和为M的子序列区间. 析:很明显最直接的方法就是暴力,可是不幸的是,由于N,M太大了,肯定会TLE的.所以我们就想能 ...
- hdu 4961 Boring Sum(数学题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4961 Problem Description Number theory is interesting ...
- HDOJ 2058 The sum problem
Problem Description Given a sequence 1,2,3,--N, your job is to calculate all the possible sub-sequen ...
随机推荐
- homework 补第三题
上次只写了两道题 发现少了一道 所以今天补上 4 . 另外补上今天的程序代码 代码 1. 2. 3 4 运行截图 1. 2 3
- 罗伯特•盖洛博士(Dr. Robert Charles Gallo)是世界著名的美国生物医学家,他以共同发现了人类免疫缺陷病毒(HIV)――这一导致获得性免疫缺陷综合症(AIDS)的致病源而闻名于世。
罗伯特•盖洛 开放分类:各国生物学家|生物学家罗伯特•盖洛博士(Dr. Robert Charles Gallo)是世界著名的美国生物医学家,他以共同发现了人类免疫缺陷病毒(HIV)――这一导致获得性 ...
- ldd3 源码相关问题参见
参考地址: http://www.verydemo.com/demo_c92_i235635.html http://blog.csdn.net/silvervi/article/details/64 ...
- selenium -- 鼠标悬停
针对页面上的二级菜单,需要鼠标悬停才能进行操作. /** * Clicks (without releasing) in the middle of the given element. This i ...
- 深入浅出parallelStream
援引:http://blog.csdn.net/u011001723/article/details/52794455 感谢作者的分享!感谢作者为JDK8的学习所做的努力. about Stream ...
- 唯快不破:Web应用的13个优化步骤
https://mp.weixin.qq.com/s?__biz=MjM5NzA1MTcyMA==&mid=2651163004&idx=2&sn=2b1be8014abf19 ...
- jQuery实现锚点滑动定位
go=function(index){ var top = $('#caseNewGuide' + index).offset().top; $('html, body').animate({ scr ...
- Segments(叉积)
Segments http://poj.org/problem?id=3304 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: ...
- 查看端口号根据pid号找到相关占用端口应用
查看端口号根据pid号找到相关占用端口应用 8080 端口被占用不知道被哪个应用软件占用,下面我来教你查出那个该死的应用 方法/步骤 1 首先用netstat 找到端口对应的pid号,找到之后 ...
- 20-最大k乘积问题
/* 最大k乘积问题 题目内容: 设I是一个n位十进制整数.如果将I划分为k段,则可得到k个整数. ...