#include <fstream>
using namespace std;
ifstream fin("date.in");
ofstream fout("date.out");
int A[50][50];
int n,m;
int p[50];
void citire()
{
int x,y,i;
fin>>n>>m;
for(i=1;i<=m;i++)
{
fin>>x>>y;
A[x][y]=A[y][x]=1;
}
}
int BF(int s)
{
int st,dr,i,x[50],j;
st=dr=1;
p[s]=1;
x[1]=s;
while(st<=dr)
{
for(i=1; i<=n; i++)
if(A[x[st]][i]!=0)
{
if(!p[i])
{
dr++;
x[dr]=i;
p[i]=1;
A[x[st]][i]=A[i][x[st]]=0;
}
else return 1;
}
st++;
}
return 0;
}
int main()
{
citire();
if(m<3) fout<<"nu contine ciclu";
else if (m>=n) fout<<"contine ciclu";
else
{
int gasit=0;
for(int i=1;i<n;i++) if(BF(i)) gasit=1;
if(gasit) fout<<"contine ciclu";
else fout<<"nu contine ciclu";
}
fin.close();
fout.close();
return 0;
}
|