一个数学问题: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(数学题)的更多相关文章

  1. HDU 2058 The sum problem 数学题

    解题报告:可以说是一个纯数学题,要用到二元一次和二元二次解方程,我们假设[a,b]这个区间的所有的数的和是N,由此,我们可以得到以下公式: (b-a+1)*(a+b) / 2 = N;很显然,这是一个 ...

  2. HDU 2058 The sum problem(枚举)

    The sum problem Problem Description Given a sequence 1,2,3,......N, your job is to calculate all the ...

  3. 题解报告:hdu 2058 The sum problem

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2058 问题描述 给定一个序列1,2,3,...... N,你的工作是计算所有可能的子序列,其子序列的总 ...

  4. hdu 2058 The sum problem(简单因式分解,,)

    Problem Description Given a sequence 1,2,3,......N, your job is to calculate all the possible sub-se ...

  5. HDU 2058 The sum problem

    传送门 Description Given a sequence 1,2,3,......N, your job is to calculate all the possible sub-sequen ...

  6. HDU - 2058 The sum problem(思路题)

    题目: Given a sequence 1,2,3,......N, your job is to calculate all the possible sub-sequences that the ...

  7. HDU 2058 The sum problem (数学+暴力)

    题意:给定一个N和M,N表示从1到N的连续序列,让你求在1到N这个序列中连续子序列的和为M的子序列区间. 析:很明显最直接的方法就是暴力,可是不幸的是,由于N,M太大了,肯定会TLE的.所以我们就想能 ...

  8. hdu 4961 Boring Sum(数学题)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4961 Problem Description Number theory is interesting ...

  9. HDOJ 2058 The sum problem

    Problem Description Given a sequence 1,2,3,--N, your job is to calculate all the possible sub-sequen ...

随机推荐

  1. 在SQL Server中使用CLR调用.NET方法

    介绍    我们一起来做个示例,在.NET中新建一个类,并在这个类里新建一个方法,然后在SQL Server中调用这个方法.按照微软所述,通过宿主 Microsoft .NET Framework 2 ...

  2. MongoDB服务无法启动,发生服务特定错误:100

    问题:MongoDB服务无法启动,发生服务特定错误:100 原因:没有正常关闭mongod服务,导致mongod被锁 解决方案:进入db文件夹,删除mongod.lock文件,然后重新启动服务即可

  3. Python print() 函数

    Python print() 函数  Python 内置函数 描述 print() 方法用于打印输出,最常见的一个函数. print 在 Python3.x 是一个函数,但在 Python2.x 版本 ...

  4. np.array()

    将列表list或元组tuple转换为 ndarray 数组. numpy.array(object, dtype=None, copy=True, order=None, subok=False, n ...

  5. ECMAScript6新特性之Reflect

    一 Reflect.ownKeys()获取对象属性. 可枚举的.不可枚举的.自有的.继承的. let fruit = { '2' : 'mango', [Symbol.for('pink')] : ' ...

  6. 模块常用snippet

    压缩,文件操作,数据库,md5,json, 压缩 import os, sys, time import zipfile # 解压 filename = 'callofdutyblackopszomb ...

  7. snowflake自增ID算法 (PHP版)

    /** * SnowFlake ID Generator * Based on Twitter Snowflake to generate unique ID across multiple * da ...

  8. vue2.0 tab切换几种方式

    第一种 比较灵活简单的方式(切换改变部分的内容在组件中比较方便操作) <template> <div id="app"> <ul> <li ...

  9. 有关gitlab的神秘操作.....version&&domain设置...

    在使用gitlab的时候,如果服务器IP变动,之前的domain写入了配置文件了,如下路径: [root@gitlab-server ~]# vim /var/opt/gitlab/gitlab-ra ...

  10. vs不同

    写了很多却错误关闭,无语,直接上内容,因为在公司年限长和德国.波兰.英国公司都有合作,而且他们的开发工具各不相同,因此我电脑上有Visual Studio 2008,Visual Studio 201 ...