Cod sursa(job #1265963)

Utilizator aschiporGheorghe Adrian Schipor aschipor Data 17 noiembrie 2014 23:53:17
Problema Lacate Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
    int n;
    fstream fs;

    fs.open("lacate.in", ios::in);

    fs >> n;
    fs.close();

    fs.open("lacate.out", ios::out);
    if (n == 2)
    {
        fs << 1 << " " << 1 << endl;
        fs << 1 << endl;
        fs << 1;
    }
    else 
    {
        fs << n << " " << 2 << endl;
        for (int i = 1; i < n; i++)
            fs << i <<  " " << i + 1 << endl;

        fs << 1 << " " << n;
    }

    fs.close();

    cout << "numarul de lacate: " << n;
}