Cod sursa(job #1925800)
| Utilizator | Data | 13 martie 2017 18:35:34 | |
|---|---|---|---|
| Problema | Lacate | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.6 kb |
#include <fstream>
#include <vector>
using namespace std;
ifstream fi("lacate.in");
ofstream fo("lacate.out");
int n,nrl,cheie;
vector<int> V[257];
vector<int> :: iterator it;
int main()
{
fi>>n;
nrl=n*(n-1)/2;
cheie=1;
for(int i=1;i<=n-1;i++)
for(int j=i+1;j<=n;j++)
{
V[i].push_back(cheie);
V[j].push_back(cheie);
cheie++;
}
fo<<nrl<<" "<<2*nrl/n<<"\n";
for(int i=1;i<=n;i++)
{
for(it=V[i].begin();it!=V[i].end();it++)
fout<<(*it)<<" ";
fout<<"\n";
}
return 0;
}