HDU 2058 The sum problem(枚举)
The sum problem
50 30
0 0
[10,10]
[4,8]
[6,9]
[9,11]
[30,30]
- #include <cstdio>
- #include <iostream>
- #include <string>
- #include <sstream>
- #include <cstring>
- #include <stack>
- #include <queue>
- #include <algorithm>
- #include <cmath>
- #include <map>
- #define PI acos(-1.0)
- #define ms(a) memset(a,0,sizeof(a))
- #define msp memset(mp,0,sizeof(mp))
- #define msv memset(vis,0,sizeof(vis))
- using namespace std;
- //#define LOCAL
- int main()
- {
- #ifdef LOCAL
- freopen("in.txt", "r", stdin);
- //freopen("out.txt","w",stdout);
- #endif // LOCAL
- ios::sync_with_stdio(false);
- int n,m;
- while(cin>>n>>m,n||m)
- {
- int t=sqrt(*m);
- while(t)
- {
- int ans=m/t-(t-)/;
- if(ans*t+(t*(t-)/)==m)
- printf("[%d,%d]\n",ans,ans+t-);
- t--;
- }
- printf("\n");
- }
- return ;
- }
HDU 2058 The sum problem(枚举)的更多相关文章
- 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
题目链接: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 数学题
解题报告:可以说是一个纯数学题,要用到二元一次和二元二次解方程,我们假设[a,b]这个区间的所有的数的和是N,由此,我们可以得到以下公式: (b-a+1)*(a+b) / 2 = N;很显然,这是一个 ...
- 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 2058 The sum problem(数学题)
一个数学问题:copy了别人的博客 #include<cstdio> #include<cstdlib> #include<cmath> int main() { ...
- HDOJ 2058 The sum problem
Problem Description Given a sequence 1,2,3,--N, your job is to calculate all the possible sub-sequen ...
- HDU 4143 A Simple Problem(枚举)
题目链接 题意 : 就是给你一个数n,让你输出能够满足y^2 = n +x^2这个等式的最小的x值. 思路 : 这个题大一的时候做过,但是不会,后来学长给讲了,然后昨天比赛的时候二师兄看了之后就敲了, ...
随机推荐
- java--调整JVM内存的大小
默认占用:64M的内存 修改内存的方式: 1.某一类,右键选择--Run Configurations 2.选择--Arguments 3.在VM argments中输入内容,如:-Xmx80m
- iOS 发布项目到CocoaPods其实没那么复杂😆
首先大家必须要了解一下CocoaPods (如果你连CocoaPods是啥都不知道可以不用往下看了
- Python中fileinput模块使用
fileinput模块可以对一个或多个文件中的内容进行迭代.遍历等操作.该模块的input()函数有点类似文件 readlines()方法,区别在于前者是一个迭代对象,需要用for循环迭代,后者是一次 ...
- C# 语言规范_版本5.0 (第9章 命名空间)
1. 命名空间 C# 程序是利用命名空间组织起来的.命名空间既用作程序的“内部”组织系统,也用作“外部”组织系统(一种向其他程序公开自己拥有的程序元素的方法). using 指令(第 9.4 节)用来 ...
- sqlserver 操作xml
1.xml.exist 输入为XQuery表达式,返回0,1或是Null.0表示不存在,1表示存在,Null表示输入为空 2.xml.value 输入为XQuery表达式,返回一个SQL ...
- 顶层const和底层const
As we’ve seen, a pointer is an object that can point to a different object. As a result,we can talk ...
- 在GNU/Linux下使用命令行自动挂载与卸载USB磁盘
在命令行环境下如果每次都是靠手动敲入mount与umount命令来挂载与卸载USB磁盘是件很麻烦的事情.尤其是mount命令的参数非常多.比如,磁盘的分区类型(vfat.ntfs等),挂载的目录节点, ...
- Java笔试题目-my
1.BuildString 和 BefferedString 默认初始容量为 16 , 超出就是 16*2 + 2; 可以看源代码得知; 2.ArrayList 默认的构造方法是一个空的Ob ...
- 利用requestjs优化响应式移动端js加载
html: <script data-main="main" src="require.js"></script> main.js re ...
- [Jmeter]jmeter之参数化
一.同一个服务器不同界面访问 a 准备工作: 1.启动jmeter: 2.创建需要访问的url文件,内容示例如下: 即比如:http://www.cnblogs.com/amberly/p/59651 ...