Cod sursa(job #2070641)

Utilizator moise_alexandruMoise Alexandru moise_alexandru Data 19 noiembrie 2017 19:37:48
Problema Tije Scor 5
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 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;
    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(1, i));
    }
    for(auto it : sol)
        out << it.first << " " << it.second << "\n";
    return 0;
}