[algogeeks] Re: SPOJ problem- TRICOUNT

2011-03-20 Thread cegprakash
now tell how u arrive at this formula?

On Mar 20, 6:25 am, Dave dave_and_da...@juno.com wrote:
 Oops. Sorry. The correct formula is n*(n+2)*(2*n+1)/8.

 Dave

 On Mar 19, 5:26 pm, sunny sunny.verma...@gmail.com wrote:

  this formula is giving wrong!!!.. :(
  can u pls tell the approach

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



Re: [algogeeks] Spoj-merectcnt

2011-03-20 Thread Ankur Khurana
problem ka link bhi diya karo ya code..

On Sun, Mar 20, 2011 at 3:34 AM, sunny sunny.verma...@gmail.com wrote:

 hello frnds...
 i am getting TLE in 12th test case ..
 can anyone over ther help me to shorten it..
 #includestdio.h
 #includeiostream
 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.



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



[algogeeks] Re: Spoj-merectcnt

2011-03-20 Thread sunny

i have given the code in the name of topic!!!
its MRECTCNT
btw
https://www.spoj.pl/problems/MRECTCNT/

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



[algogeeks] power of 2

2011-03-20 Thread cegprakash
given a how to find the maximum value of n
if 2^n a

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



[algogeeks] Re: random number generator

2011-03-20 Thread cegprakash
i dont know how to write a  function which returns true 60% time and
false 40% time

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



Re: [algogeeks] power of 2

2011-03-20 Thread priya mehta
floor (log2 (a))

On Sun, Mar 20, 2011 at 2:13 PM, cegprakash cegprak...@gmail.com wrote:

 given a how to find the maximum value of n
 if 2^n a

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



[algogeeks] Re: power of 2

2011-03-20 Thread cegprakash
how to find log2(a)  in c++?

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



[algogeeks] Re: power of 2

2011-03-20 Thread cegprakash
i'm having a biginteger in java.
how to find log2(number)??
help plz..

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



Re: [algogeeks] Re: power of 2

2011-03-20 Thread kumar anurag
in gcc it is found in math.h

On Sun, Mar 20, 2011 at 2:16 PM, cegprakash cegprak...@gmail.com wrote:

 how to find log2(a)  in c++?

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



Re: [algogeeks] Re: power of 2

2011-03-20 Thread kumar anurag
try to find the MSB position of the binary form of number. Then position+1
should be the answer

On Sun, Mar 20, 2011 at 2:27 PM, kumar anurag anurag.it.jo...@gmail.comwrote:

 in gcc it is found in math.h


 On Sun, Mar 20, 2011 at 2:16 PM, cegprakash cegprak...@gmail.com wrote:

 how to find log2(a)  in c++?

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




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



[algogeeks] Re: power of 2

2011-03-20 Thread cegprakash
how to find the MSB position with order of 1?

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



[algogeeks] Re: power of 2

2011-03-20 Thread cegprakash
i'm asking in java bigintegers

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



Re: [algogeeks] Re: power of 2

2011-03-20 Thread kumar anurag
use a precomputed table
On Sun, Mar 20, 2011 at 2:38 PM, cegprakash cegprak...@gmail.com wrote:

 i'm asking in java bigintegers

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



[algogeeks] RR Scheduling

2011-03-20 Thread Akshata Sharma
I tried to solve this problem
https://www.spoj.pl/problems/RRSCHED/

I am getting TLE!! How can I improve my code??

#includeiostream
#includestdio.h

using namespace std;

struct process
{
long time;
int finished;
long elapsed_time;
};

int main()
{
long n,sum=0;
cinn;
struct process prss[5];
for(long i=0;in;i++)
{
scanf(%ld,prss[i].time);
prss[i].finished=0;
sum+=prss[i].time;
}
long index=0;
 for(long k=1;k=sum;k++)
{
  while(prss[index].finished==1)
  index++;

  prss[index].time--;

  if(prss[index].time==0)
  {
   prss[index].finished=1;
   prss[index].elapsed_time=k;
  }

  index++;
  if(index==n)
  index=0;
}

for(long i=0;in;i++)
printf(%ld\n,prss[i].elapsed_time);
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.



Re: [algogeeks] Re: power of 2

2011-03-20 Thread Kunal Patil
@cegprakash:
y dont u use formula...
log2(n) -- log(n) / log(2)

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



[algogeeks] Compositions of a number

2011-03-20 Thread ganesha
Given a number n, write a program to output its various compositions
where order is not important.

For eg, for 5, it will be

1 + 4
1 + 1 + 3
1 + 1 + 1 + 2
1 + 1 + 1 + 1 + 1
1 + 2 + 2 and so on


 Order is not important implies 1 + 4 is same as 4 + 1.

Modify the program such that the order is important.

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



Re: [algogeeks] Re: Find the first K smallest element from 1 million sized array ...Amazon Question..

2011-03-20 Thread Natansh Verma
There's another way... use the partitioning method for quicksort to find the
k smallest elements. Then it should take expected time as O(n + klogk).
Plus, it is in-place.

On Wed, Mar 16, 2011 at 7:26 PM, asit lipu...@gmail.com wrote:

 I agree with munna

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



[algogeeks] chk dis out

2011-03-20 Thread Akash Mukherjee
Majid is a 3rd-grade elementary student and quite well in mathematics. Once,
Majid's teacher asked him to calculate the sum of numbers 1 through n.

Majid quickly answered, and his teacher made him another challenge. He asked
Majid to calculate the sum of the digits of numbers 1 through n.

Majid did finally find the solution. Now it is your turn, can you find a
solution?
Input

Two space-separated integers 0 = a = b = 109.

Program terminates if a and b are -1.
Output

The sum of the digits of numbers a through b.
Example

*Input:*
1 10
100 777
-1 -1
*Output:*
46
8655

ne ideas??

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



Re: [algogeeks] chk dis out

2011-03-20 Thread Anurag atri
http://mathforum.org/library/drmath/view/57919.html
check this out .

On Sun, Mar 20, 2011 at 7:38 PM, Akash Mukherjee akash...@gmail.com wrote:

 Majid is a 3rd-grade elementary student and quite well in mathematics.
 Once, Majid's teacher asked him to calculate the sum of numbers 1 through n.

 Majid quickly answered, and his teacher made him another challenge. He
 asked Majid to calculate the sum of the digits of numbers 1 through n.

 Majid did finally find the solution. Now it is your turn, can you find a
 solution?
 Input

 Two space-separated integers 0 = a = b = 109.

 Program terminates if a and b are -1.
 Output

 The sum of the digits of numbers a through b.
 Example

 *Input:*
 1 10
 100 777
 -1 -1
 *Output:*
 46
 8655

 ne ideas??

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




-- 
Regards
Anurag Atri

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



Re: [algogeeks] SPOJ problem-BRCKTS

2011-03-20 Thread murthy.krishn...@gmail.com
@anurag accor to me the output must be YES, correct me if I am wrong

On Sun, Mar 20, 2011 at 10:40 AM, bharath kannan bharathgo...@gmail.comwrote:

 i thot tat i had some mistake in my code and typed it all over again..
 finally i noticed this :)



 On Sat, Mar 19, 2011 at 12:12 AM, Kunal Patil kp101...@gmail.com wrote:

 Hey..
 I also got into same trouble today...
 I submitted it 6 times..then got bored and de moralised cause i cudnt find
 flaw in code...
 When i read your mail and corresponding sorry mail...it just struck me..I
 also had to print YES and NOand i was printing NO as NoIt
 got ac den...
 :P
 thnx anyway !!!

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



[algogeeks] Re: power of 2

2011-03-20 Thread Dave
int HighestBitSet (unsigned int n)
{
double x;
int exp;
x = frexp((double)n, exp);
return exp-1;
}

To see how it works, look up the standard C++ function frexp.

Dave

On Mar 20, 3:43 am, cegprakash cegprak...@gmail.com wrote:
 given a how to find the maximum value of n
 if 2^n a

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



[algogeeks] Re: Find the first K smallest element from 1 million sized array ...Amazon Question..

2011-03-20 Thread Dave
@Natansh: How do you do this with the constraint that your RAM is so
small that you cannot accomodate all of the numbers at once?

Dave

On Mar 20, 9:04 am, Natansh Verma natansh.ve...@gmail.com wrote:
 There's another way... use the partitioning method for quicksort to find the
 k smallest elements. Then it should take expected time as O(n + klogk).
 Plus, it is in-place.



 On Wed, Mar 16, 2011 at 7:26 PM, asit lipu...@gmail.com wrote:
  I agree with munna

  --
  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.- Hide quoted text -

 - Show quoted text -

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



Re: [algogeeks] Re: chk dis out

2011-03-20 Thread sanchit mittal
@dave...plz read the q carefully before answering the q.
nice link anurag...:))

On Sun, Mar 20, 2011 at 11:03 PM, Dave dave_and_da...@juno.com wrote:

 @Akash: The sum of the numbers from 1 to n is S(n) = n*(n+1)/2. Thus,
 the sum of the numbers from a to b is S = S(b) - S(a-1) = ( b*(b+1) -
 a*(a-1) ) / 2.

 Dave

 On Mar 20, 9:08 am, Akash Mukherjee akash...@gmail.com wrote:
  Majid is a 3rd-grade elementary student and quite well in mathematics.
 Once,
  Majid's teacher asked him to calculate the sum of numbers 1 through n.
 
  Majid quickly answered, and his teacher made him another challenge. He
 asked
  Majid to calculate the sum of the digits of numbers 1 through n.
 
  Majid did finally find the solution. Now it is your turn, can you find a
  solution?
  Input
 
  Two space-separated integers 0 = a = b = 109.
 
  Program terminates if a and b are -1.
  Output
 
  The sum of the digits of numbers a through b.
  Example
 
  *Input:*
  1 10
  100 777
  -1 -1
  *Output:*
  46
  8655
 
  ne ideas??

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




-- 
Sanchit Mittal
Second Year Undergraduate
Computer Engineering
Delhi College of Engineering
ph- +919582414494

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



Re: [algogeeks] RR Scheduling

2011-03-20 Thread ankit sambyal
I worked on this problem but cud not get a more efficient algo than yours.
Plz get back 2 me if u find a better algo.


On Sun, Mar 20, 2011 at 3:24 AM, Akshata Sharma
akshatasharm...@gmail.comwrote:

 I tried to solve this problem
 https://www.spoj.pl/problems/RRSCHED/

 I am getting TLE!! How can I improve my code??

 #includeiostream
 #includestdio.h

 using namespace std;

 struct process
 {
 long time;
 int finished;
 long elapsed_time;
 };

 int main()
 {
 long n,sum=0;
 cinn;
 struct process prss[5];
 for(long i=0;in;i++)
 {
 scanf(%ld,prss[i].time);
 prss[i].finished=0;
 sum+=prss[i].time;
 }
 long index=0;
  for(long k=1;k=sum;k++)
 {
   while(prss[index].finished==1)
   index++;

   prss[index].time--;

   if(prss[index].time==0)
   {
prss[index].finished=1;
prss[index].elapsed_time=k;
   }

   index++;
   if(index==n)
   index=0;
 }

 for(long i=0;in;i++)
 printf(%ld\n,prss[i].elapsed_time);
 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.


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



[algogeeks] Re: random number generator

2011-03-20 Thread Jammy
clearly the prob. of getting true|false and false|true are equal to
0.6*0.4. Therefore the following code works,

bool uniform(){
   bool f1;
   bool f2;
   do{
   f1 = non_uniform();
   f2 = non_uniform();
   }while(!(f1 ^ f2));
   return f1;
}




On Mar 17, 10:24 am, saurabh agrawal saurabh...@gmail.com wrote:
 Given a  function which returns true 60% time and false 40% time.

 Using this function you have to write a function which returns true 50% of
 the time.

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



Re: [algogeeks] Re: Find the first K smallest element from 1 million sized array ...Amazon Question..

2011-03-20 Thread Natansh Verma
@dave -was this a constraint since the beginning? In case it was, I am sorry I 
didn't notice.

In that case, the heap method ought to work better. I dont think the quicksort 
method will work.

Sent from my iPhone

On 20-Mar-2011, at 23:00, Dave dave_and_da...@juno.com wrote:

 @Natansh: How do you do this with the constraint that your RAM is so
 small that you cannot accomodate all of the numbers at once?
 
 Dave
 
 On Mar 20, 9:04 am, Natansh Verma natansh.ve...@gmail.com wrote:
 There's another way... use the partitioning method for quicksort to find the
 k smallest elements. Then it should take expected time as O(n + klogk).
 Plus, it is in-place.
 
 
 
 On Wed, Mar 16, 2011 at 7:26 PM, asit lipu...@gmail.com wrote:
 I agree with munna
 
 --
 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.- Hide quoted text -
 
 - Show quoted text -
 
 -- 
 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.



Re: [algogeeks] SPOJ problem-BRCKTS

2011-03-20 Thread bharath kannan
@murthy:no..the op must be NOits not a valid expression..read the two
conditions for a valid expression..

On Sun, Mar 20, 2011 at 8:23 PM, murthy.krishn...@gmail.com 
murthy.krishn...@gmail.com wrote:

 @anurag accor to me the output must be YES, correct me if I am wrong


 On Sun, Mar 20, 2011 at 10:40 AM, bharath kannan 
 bharathgo...@gmail.comwrote:

 i thot tat i had some mistake in my code and typed it all over again..
 finally i noticed this :)



 On Sat, Mar 19, 2011 at 12:12 AM, Kunal Patil kp101...@gmail.com wrote:

 Hey..
 I also got into same trouble today...
 I submitted it 6 times..then got bored and de moralised cause i cudnt
 find flaw in code...
 When i read your mail and corresponding sorry mail...it just struck me..I
 also had to print YES and NOand i was printing NO as NoIt
 got ac den...
 :P
 thnx anyway !!!

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



Re: [algogeeks] SPOJ problem-BRCKTS

2011-03-20 Thread murthy.krishn...@gmail.com
@bharath yaa now I got the ques, thanx :-)

On Mon, Mar 21, 2011 at 4:47 AM, bharath kannan bharathgo...@gmail.comwrote:

 @murthy:no..the op must be NOits not a valid expression..read the two
 conditions for a valid expression..

 On Sun, Mar 20, 2011 at 8:23 PM, murthy.krishn...@gmail.com 
 murthy.krishn...@gmail.com wrote:

 @anurag accor to me the output must be YES, correct me if I am wrong


 On Sun, Mar 20, 2011 at 10:40 AM, bharath kannan 
 bharathgo...@gmail.comwrote:

 i thot tat i had some mistake in my code and typed it all over again..
 finally i noticed this :)



 On Sat, Mar 19, 2011 at 12:12 AM, Kunal Patil kp101...@gmail.comwrote:

 Hey..
 I also got into same trouble today...
 I submitted it 6 times..then got bored and de moralised cause i cudnt
 find flaw in code...
 When i read your mail and corresponding sorry mail...it just struck
 me..I also had to print YES and NOand i was printing NO as
 NoIt got ac den...
 :P
 thnx anyway !!!

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


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



Re: [algogeeks] SPOJ problem-BRCKTS

2011-03-20 Thread Anurag atri
@krishna - yeah as Bharath said that case should give NO , anyways you got
it now :)

On Mon, Mar 21, 2011 at 5:50 AM, murthy.krishn...@gmail.com 
murthy.krishn...@gmail.com wrote:

 @bharath yaa now I got the ques, thanx :-)


 On Mon, Mar 21, 2011 at 4:47 AM, bharath kannan bharathgo...@gmail.comwrote:

 @murthy:no..the op must be NOits not a valid expression..read the two
 conditions for a valid expression..

 On Sun, Mar 20, 2011 at 8:23 PM, murthy.krishn...@gmail.com 
 murthy.krishn...@gmail.com wrote:

 @anurag accor to me the output must be YES, correct me if I am wrong


 On Sun, Mar 20, 2011 at 10:40 AM, bharath kannan bharathgo...@gmail.com
  wrote:

 i thot tat i had some mistake in my code and typed it all over again..
 finally i noticed this :)



 On Sat, Mar 19, 2011 at 12:12 AM, Kunal Patil kp101...@gmail.comwrote:

 Hey..
 I also got into same trouble today...
 I submitted it 6 times..then got bored and de moralised cause i cudnt
 find flaw in code...
 When i read your mail and corresponding sorry mail...it just struck
 me..I also had to print YES and NOand i was printing NO as
 NoIt got ac den...
 :P
 thnx anyway !!!

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


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




-- 
Regards
Anurag Atri

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



Re: [algogeeks] chk dis out

2011-03-20 Thread Akash Mukherjee
thanks, :)

On Sun, Mar 20, 2011 at 8:21 PM, Anurag atri anu.anurag@gmail.comwrote:

 http://mathforum.org/library/drmath/view/57919.html
 check this out .

 On Sun, Mar 20, 2011 at 7:38 PM, Akash Mukherjee akash...@gmail.comwrote:

 Majid is a 3rd-grade elementary student and quite well in mathematics.
 Once, Majid's teacher asked him to calculate the sum of numbers 1 through n.

 Majid quickly answered, and his teacher made him another challenge. He
 asked Majid to calculate the sum of the digits of numbers 1 through n.

 Majid did finally find the solution. Now it is your turn, can you find a
 solution?
 Input

 Two space-separated integers 0 = a = b = 109.

 Program terminates if a and b are -1.
 Output

 The sum of the digits of numbers a through b.
 Example

 *Input:*
 1 10
 100 777
 -1 -1
 *Output:*
 46
 8655

 ne ideas??

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




 --
 Regards
 Anurag Atri

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



Re: [algogeeks] SPOJ problem-BRCKTS

2011-03-20 Thread murthy.krishn...@gmail.com
Thanks 2 all

On Mon, Mar 21, 2011 at 9:19 AM, Anurag atri anu.anurag@gmail.comwrote:

 @krishna - yeah as Bharath said that case should give NO , anyways you got
 it now :)


 On Mon, Mar 21, 2011 at 5:50 AM, murthy.krishn...@gmail.com 
 murthy.krishn...@gmail.com wrote:

 @bharath yaa now I got the ques, thanx :-)


 On Mon, Mar 21, 2011 at 4:47 AM, bharath kannan 
 bharathgo...@gmail.comwrote:

 @murthy:no..the op must be NOits not a valid expression..read the two
 conditions for a valid expression..

 On Sun, Mar 20, 2011 at 8:23 PM, murthy.krishn...@gmail.com 
 murthy.krishn...@gmail.com wrote:

 @anurag accor to me the output must be YES, correct me if I am wrong


 On Sun, Mar 20, 2011 at 10:40 AM, bharath kannan 
 bharathgo...@gmail.com wrote:

 i thot tat i had some mistake in my code and typed it all over again..
 finally i noticed this :)



 On Sat, Mar 19, 2011 at 12:12 AM, Kunal Patil kp101...@gmail.comwrote:

 Hey..
 I also got into same trouble today...
 I submitted it 6 times..then got bored and de moralised cause i cudnt
 find flaw in code...
 When i read your mail and corresponding sorry mail...it just struck
 me..I also had to print YES and NOand i was printing NO as
 NoIt got ac den...
 :P
 thnx anyway !!!

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


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




 --
 Regards
 Anurag Atri

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



Re: [algogeeks] chk dis out

2011-03-20 Thread Anurag atri
@Sanchit - :)

On Mon, Mar 21, 2011 at 9:38 AM, Akash Mukherjee akash...@gmail.com wrote:

 thanks, :)


 On Sun, Mar 20, 2011 at 8:21 PM, Anurag atri anu.anurag@gmail.comwrote:

 http://mathforum.org/library/drmath/view/57919.html
 check this out .

 On Sun, Mar 20, 2011 at 7:38 PM, Akash Mukherjee akash...@gmail.comwrote:

 Majid is a 3rd-grade elementary student and quite well in mathematics.
 Once, Majid's teacher asked him to calculate the sum of numbers 1 through n.

 Majid quickly answered, and his teacher made him another challenge. He
 asked Majid to calculate the sum of the digits of numbers 1 through n.

 Majid did finally find the solution. Now it is your turn, can you find a
 solution?
 Input

 Two space-separated integers 0 = a = b = 109.

 Program terminates if a and b are -1.
 Output

 The sum of the digits of numbers a through b.
 Example

 *Input:*
 1 10
 100 777
 -1 -1
 *Output:*
 46
 8655

 ne ideas??

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




 --
 Regards
 Anurag Atri

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




-- 
Regards
Anurag Atri

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