Cod sursa(job #2664669)

Utilizator Xutzu358Ignat Alex Xutzu358 Data 29 octombrie 2020 08:46:49
Problema Dame Scor 60
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.7 kb
#include <bits/stdc++.h>
using namespace std;

ifstream f("dame.in");
ofstream g("dame.out");

bool colon[1005];
int dame;
int n;
int col;

int main()
{
    f >> n;
    dame = n;
    int lin = 1;
    int col = 2;

    if (n>3) {
        g << n <<'\n';
        col = 2;
        for (int i=1;i<=n/2;i++) {
            g << i << " " << col << '\n';
            col+=2;
        }
        col = 1;
        for (int i=n/2+1;i<=n;i++) {
            g << i << " " << col << '\n';
            col+=2;
        }
    }
    else if (n<=2) {
        g << 1 <<'\n' << 1 << " " <<1;
    }
    else {
        g << 2 << '\n' << 1 << " " << 1 << '\n' << 2 << " " << 3;
    }
    return 0;
}