Cod sursa(job #2070647)
Utilizator | Data | 19 noiembrie 2017 19:40:54 | |
---|---|---|---|
Problema | Tije | Scor | 85 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.59 kb |
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
ifstream in("tije.in");
ofstream out("tije.out");
vector <pair <int, int> > sol;
int main()
{
int n;
in >> n;
int last = n + 1;
n--;
for(int i = n; i >= 1; i--)
{
for(int j = n + 1; j >= 1; j--)
for(int k = 1; k <= i; k++)
sol.push_back(make_pair(j, j + 1));
for(int j = 1; j <= i; j++)
sol.push_back(make_pair(last, 1));
}
for(auto it : sol)
out << it.first << " " << it.second << "\n";
return 0;
}