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 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.

Reply via email to