Advertisement
Guest User

codul lui mangher

a guest
May 20th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. #include <fstream>
  2.  
  3. using namespace std;
  4. ifstream fin("frunze.in");
  5. ofstream fout("frunze.out");
  6.  
  7. int t[101];
  8. int main()
  9. {
  10. bool frunza;
  11. int n,rad,nrf=0;
  12. fin >> n;
  13. for(int i=1;i<=n;i++)
  14. {
  15. fin>>t[i];
  16. if(t[i]==0)
  17. rad=i;
  18. }
  19.  
  20. fout<<rad<< "\n";
  21.  
  22. for(int i=1;i<=n;i++)
  23. {
  24. frunza=true;
  25. for(int j=1;j<=n;j++)
  26. if(t[j]==i)
  27. frunza=false;
  28.  
  29. if(frunza)
  30. nrf++;
  31. }
  32. fout<< nrf << "\n";
  33. for(int i=1;i<=n;i++)
  34. {
  35. frunza=true;
  36. for(int j=1;j<=n;j++)
  37. if(t[j]==i)
  38. frunza=false;
  39.  
  40. if(frunza)
  41. fout<< i<< ' ';
  42. }
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement