Pagini recente » Cod sursa (job #3198244) | Cod sursa (job #473611) | Cod sursa (job #1387246) | Cod sursa (job #2685851) | Cod sursa (job #1854569)
#include <fstream>
#include <vector>
#include <cmath>
using namespace std ;
ifstream cin ( "consecutive.in" ) ;
ofstream cout ("consecutive.out") ;
const int MAX = 1e6 + 14 ;
vector < pair < int , int > > sol ;
int main ( )
{
int t ;
cin >> t ;
while ( t -- ) {
sol.clear() ;
int n ;
cin >> n ;
int len = 2 ;
while ( 1LL * len * (len + 1) / 2 <= n ) {
int aux = 1LL * len * (len + 1) / 2 ;
int rest = n - aux ;
if ( rest % len == 0 ) {
sol.push_back ( make_pair ( rest / len + 1 , rest / len + len ) ) ;
//cout << "am bagat " << rest/len + 1 << " pentru lungimea " << len << endl ;
}
len += 1 ;
}
cout << sol.size() << '\n' ;
for ( auto x : sol ) {
cout << x.first << ' ' << x.second << '\n' ;
}
}
return 0 ;
}