http://acm.hdu.edu.cn/showproblem.php?pid=2058
#include <bits/stdc++.h>
using namespace std;
int n,m;
int main() {
while(~scanf("%d%d", &n, &m)) {
if( n == 0 && m == 0) break;
for(int i = sqrt(2 * m); i >= 1; i --) {
int a = (m - ((i - 1) * i) / 2) / i;
if(m == a * i + (i * (i - 1)) / 2)
cout<< ‘[‘ << a << ‘,‘ << a + i - 1 << ‘]‘ <<endl;
}
printf("\n");
}
return 0;
}
原文:https://www.cnblogs.com/zlrrrr/p/9380144.html