Cod sursa(job #278717)

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