Cod sursa(job #2181956)

Utilizator clara123Ghira Clara clara123 Data 21 martie 2018 23:02:42
Problema Tablete Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.64 kb
#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;
}