Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Afisati cea mai mare distanta dintre doua platouri
- de lungime maxima
- */
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- ifstream cin("test.in");
- ofstream cout("test.out");
- int x,y,s=1,lung=1,lmax=0,vmin=9999999,prim,ultim,poz=1,dis,dmax,sf;
- cin>>x;
- while(cin>>y){
- poz++;///pozitia curenta
- // cout<<x<<" "<<y<<endl;
- if(x!=y){
- s++;
- lung=1;
- }
- else{ ///x==y
- lung++;
- if(lung>lmax){
- dmax=0;
- lmax=lung;
- vmin=y;
- prim=y;
- ultim=y;
- }
- else if(lung==lmax){
- ultim=y;
- if(vmin>y){
- vmin=y;
- }
- }
- }
- x=y;
- }
- cout<<lmax<<" "<<vmin<<endl<<prim<<" "<<ultim;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement