Cod sursa(job #712801)

Utilizator 5t3fristea stefan 5t3f Data 13 martie 2012 20:08:36
Problema Tablete Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.47 kb
// tablete.cpp : Defines the entry point for the console application.
//

//#include "stdafx.h"
#include "fstream"
using namespace std;
int main()
{
	ifstream f("tablete.in");
	ofstream g("tablete.out");
	int n,col,i,j,nr=1;
	f>>n>>col;
	for(i=1;i<=n;i++)
	{
		if(col%n==0)
			for(j=1;j<=n;j++)
			{
				g<<nr<<" ";
				nr++;
			}
		else
		{
			for(j=1;j<n;j++)
			{
				g<<nr+1<<" ";
				nr++;
			}
			g<<nr-n<<" ";
		}
		g<<"\n";
	}
	return 0;
}