Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include < iostream >
  2. #include < fstream >
  3. using namespace std;
  4. ifstream f("secventaincadrata.in");
  5. ofstream g("secventaincadrata.out");
  6. int cif, poz[10], lung[10], c, lungmax;
  7. int main()
  8. {
  9. while (f >> cif)
  10. {
  11. ++c;
  12. if (poz[cif]==0) { poz[cif]=c; lung[cif]=1; }
  13. else lung[cif]=c-poz[cif]+1;
  14. }
  15.  
  16. for (cif=0; cif < 10; ++cif)
  17. if (lung[cif] > lungmax) lungmax=lung[cif];
  18. g << lungmax << "\n";
  19. for (cif=0; cif < 10; ++cif)
  20. if (lung[cif]==lungmax) g << cif << " ";
  21. }
  22.  
  23. Citește mai multe pe Brainly.ro - https://brainly.ro/tema/5844981#readmore
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement