您的位置:首页 > 其它

hdu 2058 The sum problem

2011-09-19 10:54 405 查看
http://acm.hdu.edu.cn/showproblem.php?pid=2058

/*
2011-9-19
author:BearFly1990
*/
package acm.hdu.tests;

import java.io.BufferedInputStream;
import java.util.Scanner;

public class HDU_2058 {
public static void main(String[] args) {
Scanner in = new Scanner(new BufferedInputStream(System.in));
while(in.hasNext()){
int n = in.nextInt();
int m = in.nextInt();
int len = (int) Math.sqrt(2.0*m);
for(int i=len; i>=1; --i)
{
int temp = m-(i*i+i)/2;
if(temp%i == 0)
System.out.printf("[%d,%d]\r\n", temp/i+1, temp/i+i);
}
System.out.printf("\r\n");
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: