Pagini recente » Cod sursa (job #1285371) | Cod sursa (job #1444086) | Cod sursa (job #1623562) | Cod sursa (job #629770) | Cod sursa (job #2181956)
#include <fstream>
using namespace std;
ifstream fin ("tablete.in");
ofstream fout ("tablete.out");
int i,n,k,x,j,v[1001][1001];
int main (){
fin>>n>>k;
x=0;
for(i=1;i<=n;i++){
for(j=1;j<=n;j++)
{
if(j==k)
{
if((x-1)%2==0)
x++;
else
x=x+2;
}
else{
x++;
}
v[i][j]=x;
}
}
for(i=1;i<=n;i++){
for(j=1;j<=n;j++)
fout<<v[i][j]<<" ";
fout<<"\n";
}
return 0;
}