Cod sursa(job #278709)

Utilizator RoCkyRomila RoCky Data 12 martie 2009 14:28:05
Problema Tablete Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.69 kb
#include <fstream.h>
ifstream f("tablete.in");
ofstream g("tablete.out");
int main ()
{
    int a[99][99],n,k,p=1,i,j;
    f>>n;
    f>>k;
    k--;
    for(i=0;i<n;i++)
    {
    for(j=0;j<n;j++)
    {
                    if(j==k)
                    {
                            if(p%2==0)
                            a[i][j]=p;
                            else
                            {p++; a[i][j]=p;}
                    g<<a[i][j]<<" ";
                    }
                    else
                    {p++;
                        a[i][j]=p;
                        p++;
                        g<<a[i][j]<<" ";
                        }
    }
    g<<"\n";
    }
}