Advertisement
rotti321

Practice IX

Mar 31st, 2022
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. int main(){
  6. // ifstream cin("test.in");
  7. // ofstream cout("test.out");
  8. int n,a[10]={},nr,maxx=0;
  9. cin>>n;
  10. for(int i=1; i<=n; i++){
  11. cin>>nr;
  12. if(nr>maxx){
  13. maxx=nr;
  14. }
  15. if(nr<10){
  16. a[nr]++;
  17. }
  18. }
  19. cout<<maxx<<endl;
  20. for(int i=1; i<=9; i=i+2){
  21. ///if(i%2==1)
  22. for(int j=1; j<=a[i]; j++){
  23. cout<< i<< " ";
  24. }
  25. }
  26. }
  27.  
  28. /*
  29. 8
  30. 102 3 7 2 23 5 10001 5
  31.  
  32.  
  33. 2 3 5 5 7
  34. */
  35.  
  36.  
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement