Cod sursa(job #1427436)

Utilizator justaddcodeJustadd Code justaddcode Data 2 mai 2015 11:36:16
Problema Dame Scor 15
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.74 kb
#include <cstdio>
#include <algorithm>
#include <cstring>
#define Nmax 1002
using namespace std;
int n, i, j, l, p, q, nr;
bool a[Nmax][Nmax];
struct nod
{
    int x;
    int y;
}sol[Nmax];
int main()
{
    freopen("dame.in", "r", stdin);
    freopen("dame.out", "w", stdout);
    scanf("%d", &n);
        p = n / 2; q = n;
        printf("%d\n", n);
        for (i = 1; i <= n; ++i)
        {
            if (i % 2 == 1)
            {
                printf("%d %d\n", i, p);
                --p;
            }   else
            {
                if (i % 4 == 0)
                { printf("%d %d\n", i, q); q -= 2;}
                else
                printf("%d %d\n", i, q - 1);
            }
        }

    return 0;
}