https://www.spoj.pl/problems/STREETR/
On 3/12/11, kumar anurag <anurag.it.jo...@gmail.com> wrote: > which probem ? pls gve the link.... > On Sat, Mar 12, 2011 at 8:27 PM, Akshata Sharma > <akshatasharm...@gmail.com>wrote: > >> yeah I too got AC. The way I was calculating gcd was not efficient. :) >> >> On 3/12/11, 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. >> > >> > >> >> -- >> 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. >> >> > > > -- > Kumar Anurag > > -- > 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.