Cod sursa(job #2029581)
| Utilizator | Data | 30 septembrie 2017 11:46:19 | |
|---|---|---|---|
| Problema | Tablete | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.67 kb |
#include <fstream>
using namespace std;
ifstream f ("tablete.in");
ofstream g ("tablete.out");
int n, k, a[1000][1000];
void construire ()
{
int imp=1, p=2;
for(int i=0; i<n; i++)
for(int j=0; j<n; j++)
if(i==k-1)
{
a[j][i]=p;
p+=2;
}
else
{
a[j][i] = imp;
imp+=2;
}
}
void afisare ()
{
for(int i=0; i<n; i++)
{
for(int j=0; j<n; j++)
g<<a[i][j]<<' ';
g<<endl;
}
}
int main()
{
f>>n>>k;
construire();
afisare();
return 0;
}
