Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <climits>
- #include <cmath>
- using namespace std;
- int main()
- {
- int c;
- int x,Max,Min,maxpoz,minpoz,poz;
- cin>>c;
- Max=INT_MIN;
- Min=INT_MAX;
- poz=1;
- while((cin>>x)&&(x!=0))
- {
- if(x%10==c)
- {
- if(x<Min)
- Min=x,minpoz=poz;
- if(x>Max)
- Max=x,maxpoz=poz;
- }
- ++poz;
- }
- if(Max==INT_MIN)
- cout<<"NU EXISTA";
- else
- cout<<abs(maxpoz-minpoz)+1;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement