1104 afișări Predesel Elena (Ella) 17.11.2017 www.pbinfo.ro
Etichete: nicio etichetă

#include <iostream>
#include<fstream>
using namespace std;
int n,li,lf,c,i,lmax,cmax,ap=0;
bool ok=1; char a1003;
int main()
{
ifstream fin(“betisoare1.in”);
ofstream fout(“betisoare1.out”);
fin>>n;
fin>>a; c=a0-48; lf=1;
for(i=1;i<n;i++)
{ if(a[i-1]==a[i]) lf++; else if(lf>lmax) { lmax=lf; cmax=c; c=a[i]-48; lf=1;ap=1; } else if(lmax==lf) {if(c==1)

{if(0==cmax) { cmax=1; ap=1; lf=1; c=a[i]-48; }} else {ap++; lf=1; c=a[i]-48;} } else {lf=1;c=a[i]-48;}

}
if(lf>lmax) { lmax=lf; cmax=c; c=a[n]-48; lf=1;ap=1; } else if(lmax==lf) if(c==1) { if(0==cmax) { cmax=1; ap=1; lf=1; } } else {ap++; lf=1; c=a[n]-48;}

fout<<cmax<<” “<<lmax<<”\n”<<ap;

}


1104 afișări Predesel Elena (Ella) 17.11.2017 www.pbinfo.ro