Advertisement
a53

Grade11

a53
May 15th, 2022
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int n, m, a[101], b[101], ok;
  5.  
  6. int main()
  7. {
  8. ios_base::sync_with_stdio(0);
  9. cin.tie(0);
  10. cout.tie(0);
  11. int x, y, i;
  12. cin>>n>>m;
  13. for(i=1; i<=m; i++)
  14. {
  15. cin>>x>>y;
  16. a[x]++;
  17. b[y]++;
  18. }
  19. for(i=1; i<=n; i++)
  20. if(a[i] && b[i])
  21. {
  22. if(a[i]%b[i]==0 || b[i]%a[i]==0)
  23. cout<<i<<" ", ok=1;
  24. }
  25. if(!ok)
  26. cout<<"NU EXISTA";
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement