Cod sursa(job #2855137)

Utilizator alextheseal1240Alex Vladu alextheseal1240 Data 22 februarie 2022 09:49:08
Problema Dame Scor 60
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.6 kb
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("dame.in");
ofstream fout("dame.out");
int i=1, j=2, n;
void read()
{
    fin >> n;
    if (n == 1 || n == 2)
        fout << "1\n1 1";
    else if (n == 3)
        fout << "2\n1 1\n2 3";
    else{
        fout << n << "\n";
        while(j<=n)
        {
            fout << i << " " << j << "\n";
            i++, j+=2;
        }
        j=1;
        while(j<=n && i<=n)
        {
            fout << i << " " << j << "\n";
            i++, j+=2;
        }
    }
}
int main()
{
    read();
    return 0;
}