i Agree.....the test cases for which problem is being jugdged might not have those larger values.....
On Tue, Mar 15, 2011 at 12:20 PM, UTKARSH SRIVASTAV <usrivastav...@gmail.com > wrote: > well i have a doubt the test case says number could be as large as > 1000000000 and you have taken int but int does not have such range then how > it is accepted > > > On Sat, Mar 12, 2011 at 7:57 PM, Logic King <crazy.logic.k...@gmail.com>wrote: > >> Here is my solution.....i got it AC >> >> #include<stdio.h> >> int gcd(int a, int b) >> { int temp; >> while(b) >> { >> temp = a % b; >> a = b; >> b = temp; >> } >> return(a); >> } >> >> int main() >> { >> int n,i,min,ans=0; >> scanf("%d",&n); >> int arr[n],ard[n]; >> ard[0]=1; >> if(n>0) >> scanf("%d",&arr[0]); >> for(i=1;i<n;i++) >> { >> scanf("%d",&arr[i]); >> ard[i]=arr[i]-arr[i-1]; >> if(i==1) >> min=ard[i]; >> else >> min=gcd(min,ard[i]); >> >> } >> for(i=1;i<n;i++) >> { >> ans+=((ard[i]/min)-1); >> } >> printf("%d",ans); >> return 0; >> >> } >> >> >> >> On Sat, Mar 12, 2011 at 7:37 PM, Balaji Ramani <rbalaji.psgt...@gmail.com >> > wrote: >> >>> Yeah, I too am wondering how to implement more efficiently. >>> >>> >>> On Sat, Mar 12, 2011 at 7:36 PM, Satyam Kapoor <satyamkapoo...@gmail.com >>> > wrote: >>> >>>> >>>> >>>> @balaji:i hve got ac with gcd method but the time is 0.32 sec >>>> best soln is 0.03 >>>> how is that achievable? >>>> -- >>>> Satyam Kapoor >>>> B.Tech 2nd year >>>> Computer Science And Engineering >>>> M.N.N.I.T ALLAHABAD >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" group. >>>> To post to this group, send email to algogeeks@googlegroups.com. >>>> To unsubscribe from this group, send email to >>>> algogeeks+unsubscr...@googlegroups.com. >>>> For more options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > *UTKARSH SRIVATAV* > *CSE-3 > B-Tech 2nd Year > @MNNIT ALLAHABAD* > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.