Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int q=0,n,a[11],one=-9997,two=-9997,three=-9997,four=-9997,five=-9997,six=-9997,z=0,didz=-1000001;
- cin>>n;
- for(int i=0;i<n;i++)
- {
- cin>>a[i];
- }
- for(int j=0;j<n;j++)
- {
- for(int s=0;s<n-1;s++)
- {
- if(z+1>n-1){break;}
- if(a[j]==a[z+1]){
- if(one==-9997){one=a[j];}
- else if(two==-9997 && a[j]!=one){two=a[j];}
- else if(three==-9997 && a[j]!=one && a[j]!=two){three=a[j];}
- else if(four==-9997 && a[j]!=one && a[j]!=two && a[j]!=three){four=a[j];}
- else if(five==-9997 && a[j]!=one && a[j]!=two && a[j]!=three && a[j]!=four){five=a[j];}
- else if(five==-9997 && a[j]!=one && a[j]!=two && a[j]!=three && a[j]!=four && a[j]!=five){six=a[j];}
- q++;}
- z++;
- }
- z=j+1;
- }
- for(int aa=0;aa<n;aa++)
- {
- for(int bb=0;bb<n;bb++)
- {
- if(q>0){
- if(a[bb]!=one && a[bb]!=two && a[bb]!=three && a[bb]!=four && a[bb]!=five && a[bb]>didz)
- {didz=a[bb];}else{}
- }else{
- if(a[bb]>didz)
- {didz=a[bb];}
- }
- }
- }
- if(didz!=-1000001){cout<<didz<<endl;}else{cout<<"NO"<<endl;}
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement