problem ka link bhi diya karo ya code..........
On Sun, Mar 20, 2011 at 3:34 AM, sunny <[email protected]> wrote:
> hello frnds...
> i am getting TLE in 12th test case ..
> can anyone over ther help me to shorten it..
> #include<stdio.h>
> #include<iostream>
> using namespace std;
> int gcd(int a, int b)
> { if(b==0)
> return(a);
> else
> return gcd(b,a%b);
>
> }
> int main()
> {
> int rec,g,count=0;
> scanf("%d",&rec);
> for(int i=1;i<=rec;i++){
> for( int j=i;j>=1;j--){
> if((i+j)>rec){
> g=gcd(i,j);
> if((i+j-g)==rec){
> count++;
>
> }
> }
> else
> break;
> }
> }
> printf("%d",count);
> return 0;
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.