Advertisement
rengetsu

ProcedurProgramavimas_2.14

Apr 5th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.19 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int q=0,n,a[11],one=-9997,two=-9997,three=-9997,four=-9997,five=-9997,six=-9997,z=0,didz=-1000001;
  6. cin>>n;
  7. for(int i=0;i<n;i++)
  8. {
  9. cin>>a[i];
  10. }
  11. for(int j=0;j<n;j++)
  12. {
  13.     for(int s=0;s<n-1;s++)
  14.     {
  15.         if(z+1>n-1){break;}
  16.         if(a[j]==a[z+1]){
  17.             if(one==-9997){one=a[j];}
  18.             else if(two==-9997 && a[j]!=one){two=a[j];}
  19.             else if(three==-9997 && a[j]!=one && a[j]!=two){three=a[j];}
  20.             else if(four==-9997 && a[j]!=one && a[j]!=two && a[j]!=three){four=a[j];}
  21.             else if(five==-9997 && a[j]!=one && a[j]!=two && a[j]!=three && a[j]!=four){five=a[j];}
  22.             else if(five==-9997 && a[j]!=one && a[j]!=two && a[j]!=three && a[j]!=four && a[j]!=five){six=a[j];}
  23.             q++;}
  24.     z++;
  25.     }
  26. z=j+1;
  27. }
  28. for(int aa=0;aa<n;aa++)
  29. {
  30.     for(int bb=0;bb<n;bb++)
  31.     {
  32.         if(q>0){
  33.             if(a[bb]!=one && a[bb]!=two && a[bb]!=three && a[bb]!=four && a[bb]!=five && a[bb]>didz)
  34.             {didz=a[bb];}else{}
  35.         }else{
  36.         if(a[bb]>didz)
  37.         {didz=a[bb];}
  38.         }
  39.     }
  40. }
  41. if(didz!=-1000001){cout<<didz<<endl;}else{cout<<"NO"<<endl;}
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement