Advertisement
alex326

Untitled

Apr 16th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. problema 98
  2.  
  3. #include <fstream>
  4. using namespace std;
  5. ifstream fin("maxim4.in");
  6. ofstream fout("maxim4.out");
  7. int main()
  8. {
  9. int v[100],n,c=0,mx=-1001,i;
  10. fin>>n;
  11. for (i=0;i<n;i++)
  12. fin>>v[i];
  13. for (i=0;i<n;i++){
  14. if (v[i]>mx){
  15. mx=v[i];
  16. c=0;
  17. }
  18. if (v[i]==mx)
  19. c++;
  20. }
  21. fout<<mx<<' '<<c;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement