Cod sursa(job #2753761)
Utilizator | Data | 24 mai 2021 12:02:29 | |
---|---|---|---|
Problema | Consecutive | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva ICPC | Marime | 0.46 kb |
#include <fstream>
using namespace std;
ifsteam cin("consecutive.in");
ofstream cout("consecutive.out");
int main()
{
int t, n;
cin >> t;
for(int i = 1; i <= t; i ++){
cin >> n;
for(int j = 2; j * (j + 1) / 2 <= n; j ++){
int sum = j * (j + 1) / 2;
if((n - sum) % j == 0){
cout << 1 + (n - sum) / j << " " << (n - sum) / j + j << "\n";
}
}
}
return 0;
}