|
|
back to boardIf anyone can help me? Look at my program. //program 1079 #include<iostream.h> void main() { int a[10000],max[10]; int i,j,num,n; for(i=0;i<10;i++) { cin>>n; if(n==0) break; max[i]=0; for(j=0;j<=n;j++) { if(j==0) a[j]=0; else if(j==1) a[j]=1; else if(j%2==0) a[j]=a[j/2]; else a[j]=a[(j-1)/2]+a[(j-1)/2+1]; if(a[j]>max[i]) max[i]=a[j]; } } num=i; for(i=0;i<num;i++) cout<<max[i]<<endl; } Re: If anyone can help me? Look at my program. restriction for n is 100000 not 10000! Re: If anyone can help me? Look at my program. Thank you. I'm so careless. |
|
|