hdoj2058

5220 단어 OJ
Problem : 2058 ( The sum problem )     Judge Status : Accepted RunId : 2716000    Language : C++    Author : huwenbiao Code Render Status : Rendered By HDOJ C++ Code Render Version 0.01 Beta
/***************************************************************\
*Author:Hu Wenbiao
*Created Time: Fri 30 Jul 2010 11:14:32 AM CST
*File Name: main.cpp
*Description:
\***************************************************************/

//*========================*Head File*========================*\\

#include<iostream>
#include<stdio.h>
#include<math.h>
/*----------------------*Global Variable*----------------------*/
int
N,M,len,tem;

//*=======================*Main Program*=======================*//
using namespace std;

int
main(){

//freopen("input","r",stdin);
while(scanf("%d%d",&N,&M)!=EOF&&N&&M){
len=sqrt(
2.0*M);//
for(;len;len--){
tem=M-(len+
1)*len/2;
if
(tem%len)
continue
;
printf(
"[%d,%d]
"
,tem/len+1,tem/len+len);
}

printf(
"
"
);
}
}

좋은 웹페이지 즐겨찾기