Pagini recente » Cod sursa (job #825406) | Cod sursa (job #2951281) | Cod sursa (job #2647369) | Cod sursa (job #2045616) | Cod sursa (job #1710121)
#include <fstream>
#include <utility>
#include <vector>
#include <string>
using namespace std;
const string filename = "consecutive";
void do_test(ifstream& f, ofstream& g){
long long n;
f >> n;
vector<pair<int, int>> rez;
for(long long len = 2, min_sum = 3; min_sum <= n; ++len, min_sum += len){
if((n-min_sum) % len == 0){
rez.emplace_back((n-min_sum) / len + 1, len); } }
g << rez.size() << '\n';
for(const auto x : rez){
g << x.first << ' ' << x.first + x.second - 1 << '\n'; } }
int main(){
ifstream f(filename + ".in");
ofstream g(filename + ".out");
int t;
for(f >> t; t; --t){
do_test(f, g); }
return 0; }