Pagini recente » Cod sursa (job #1658990) | Cod sursa (job #2848668) | Cod sursa (job #1535527) | Cod sursa (job #1676672) | Cod sursa (job #1908957)
#include <fstream>
#include <vector>
using namespace std;
ifstream fi("lacate.in");
ofstream fo("lacate.out");
int n;
int nrl,cheie;
vector<int> V[256];
vector<int> :: iterator it;
int i,j;
int main()
{
fi>>n;
nrl=n*(n-1)/2;
cheie=1;
for(i=1;i<=n-1;i++)
for(j=i+1;j<=n;j++)
{
V[i].push_back(cheie);
V[j].push_back(cheie);
cheie++;
}
fo<<nrl<<" "<<cheie-1<<"\n";
for(i=1;i<=n;i++)
{
for(it=V[i].begin();it!=V[i].end();it++)
fo<<(*it)<<" ";
fo<<"\n";
}
fi.close();
fo.close();
return 0;
}