Cod sursa(job #243918)

Utilizator Andrei200Andrei200 Andrei200 Data 14 ianuarie 2009 11:21:48
Problema Tablete Scor 20
Compilator c Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <stdio.h>

int n,k,i,j,h,a[100][100];

int main()
{
    freopen("tablete.in","r",stdin);
    freopen("tablete.out","w",stdout);
    scanf("%d %d",&n,&k);
    h=1;
    for (i=1;i<=n;++i)
    for (j=1;j<=k;++j)
         {
                a[i][j]=h;
                h++;
            }
    for (i=1;i<=n;++i)
    for (j=k+1;j<=n;++j)
         {
                a[i][j]=h;
                h++;
            }      
    for (i=1;i<=n;++i)
     {
      for (j=1;j<=n;++j)
      printf("%d ", a[i][j]);
      printf("\n");
     }
return 0;
}