1312 Continuous natural numbers and
time limit: 1 sspace limit: 128000 KBtitle level: Golden Gold SolvingView Run ResultsTitle Description
Description
For a natural number m, all contiguous natural number segments are calculated, making all the numbers of these contiguous natural segments and M.
eg:1998+1999+2000+2001+2002=10000, so a natural number segment from 1998 to 2002 is a solution to the m=10000.
Enter a description
Input Description
A few M
Output description
Output Description
Two numbers per line, one end of a continuous natural number segment, and the first number of all output lines in ascending order
Sample input
Sample Input
10000
Sample output
Sample Output
18 142
297 328
388 412
1998 2002
Data range and Tips
Data Size & HintCategory labels
Tags Click here to expandArithmetical
Number theory bye, enumerate the flood questions!
AC Code:
#include <iostream>using namespacestd;intMain () {intM;cin>>m; for(intI=1; i<m;i++){ intp=0; for(intj=i;p<m;j++) {p+=J; if(p==L) {cout<<i<<" "<<j<<"\ n"; Break; } } } return 0;}
1312 Continuous natural numbers and