Cod sursa(job #1871133)
Utilizator | Data | 7 februarie 2017 10:37:59 | |
---|---|---|---|
Problema | Tablete | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.63 kb |
#include<cstdio>
int main(){
int n,k,i,j,par,max,nr;
freopen("tablete.in","r",stdin);
freopen("tablete.out","w",stdout);
scanf("%d%d",&n,&k);
max=2*n;
par=2;
nr=1;
for(i=1;i<=n;i++){
for(j=1;j<=n;j++)
if(j!=k)
if(nr%2==0&&nr<=max){
nr++;
j--;
}
else{
printf("%d ",nr);
nr++;
}
else{
printf("%d ",par);
par+=2;
}
printf("\n");
}
return 0;
}