Varianta 53 / Subiectul 3 / Problema 3 |
#include<fstream.h> ifstream f("date.in"); long cmmdc(long a, long b) { while(a!=b) if(a>b) a=a-b; else b=b-a; return a; } void main() { int n,l,i,max=0; long x,y; f>>n>>x; l=1; for(i=2;i<=n;i++) { f>>y; if(cmmdc(x,y)==1) l++; else if(max<l) { max=l; l=1; } x=y; } cout<<max; } |