Cod sursa(job #2206130)

Utilizator Andrei_CotorAndrei Cotor Andrei_Cotor Data 21 mai 2018 12:31:58
Problema Dame Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
#include<fstream>
using namespace std;
ifstream fi("dame.in");
ofstream fo("dame.out");
int n,i,x,y;
int main()
{
    fi>>n;
    fo<<n<<"\n";
    x=1;
    y=1;
    for(i=1; i<=n/2+1; i++)
    {
        fo<<x<<" "<<y<<"\n";
        x+=2;
        y++;
        if(x>n)
            break;
    }
    x=2;
    for(i=1; i<=n/2+1; i++)
    {
        fo<<x<<" "<<y<<"\n";
        x+=2;
        y++;
        if(x>n)
            break;
    }
    return 0;
}