Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define N 205
- using namespace std;
- ifstream fin("euler.in");
- ofstream fout("euler.out");
- int a[N][N],n;
- int L[50005],ct;
- bool gasit;
- void Citire()
- {
- int x,y;
- fin>>n;
- while(fin>>x>>y) a[x][y]=a[y][x]=1;
- }
- void Euler(int k)
- {
- for(int i=1;i<=n;i++)
- if(a[k][i]==1)
- {
- a[k][i]=a[i][k]=0;
- Euler(i);
- }
- L[++ct]=k;
- }
- void Afisare()
- {
- fout<<ct<<'\n';
- for(int i=1;i<=ct;i++)
- fout<<L[i]<<' ';
- }
- int main()
- {
- Citire();
- Euler(1);
- Afisare();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement