[algogeeks] Re: Google puzzles

2011-03-17 Thread bittu
Hi here is the basic approach as we know in a week atmost 7 days ..so start with hit and trial Total 36 medals were awarded and the contest was for 6 days. On day 1: Medals awarded = (1 + 35/7) = 6 : Remaining 30 medals On day 2: Medals awarded = (2 + 28/7) = 6 : Remaining 24 medals On day 3: Me

Re: [algogeeks] Re: Print Hello

2011-03-17 Thread saurabh singh
@Manikanta Babu. Dont say you were using dev C++ or turbo c++You must be knowing that if you dont specify these compilers will compile the code in c++ format.Try this in gcc which is the standard compiler for c and if you dont get any error then report.ITS COMPLETELY ILLEGAL TO INITIALIZE A VAR

Re: [algogeeks] Re: Print Hello

2011-03-17 Thread Manikanta Babu
@Dondod is right. It works perfectly. Because printf returns the number of characters printed so n will be initialized with the number of characters. You can try out this simple program. I checked its working perfectly. Thanks, Mani On Fri, Mar 18, 2011 at 9:59 AM, .bashrc wrote: > @Don.Its ille

[algogeeks] Re: Print Hello

2011-03-17 Thread .bashrc
The only possible solution that i can think off- #include #define main() main(){printf("Hello");} main() -- 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

[algogeeks] Re: Print Hello

2011-03-17 Thread .bashrc
@Don.Its illegal in c(Or in c99) to initialize a variable with anything other than a constant. @pacific No c structures do not support constructor(Or destructor) On Mar 18, 9:08 am, pacific pacific wrote: > Does  C struct have constructor ? > > > > On Fri, Mar 18, 2011 at 12:55 AM, Don wrote: >

Re: [algogeeks] Re: Print Hello

2011-03-17 Thread pacific pacific
Does C struct have constructor ? On Fri, Mar 18, 2011 at 12:55 AM, Don wrote: > int n = printf("Hello\n"); > > int main() > { > > } > > On Mar 17, 8:08 am, himanshu kansal > wrote: > > is there any way to print hello in c also wdout writing anythng in > > main() > > > > On Thu, Mar 17, 201

Re: [algogeeks] Another maths problem

2011-03-17 Thread saurabh singh
Gud observation.Acknowledge it was too easy but i have seen people using binomial expansion to get the answer..lol -- 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 uns

Re: [algogeeks] Re: linked list

2011-03-17 Thread sanjay ahuja
method 1 struct node { void* data; unsigned int size; struct node* next; }; struct node* allocateNode(void* data,unsigned int n) { struct node* temp = (struct node*) malloc(sizeof(struct node)); temp->size = n; temp->next = NULL; temp->data = malloc(n); for(int i=

[algogeeks] Re: random number generator

2011-03-17 Thread Dave
@Don: Clever and efficient code to meet the problem statement precisely. It does give true on half of the calls, but it doesn't give true with probability 50% on any given call, so we wouldn't want to use it to model a fair coin. Dave On Mar 17, 1:03 pm, Don wrote: > bool uniform() > { >   stati

[algogeeks] Re: Spoj Problem

2011-03-17 Thread KK
i m getting TLE for this soln and m not getting the concept used in the above soln can anyone help?? #include using namespace std; int main() { int t,n,k,no,flag; scanf("%d",&t); while(t--) { scanf("%d",&n); k = n; int a[100] = {0};

[algogeeks] Re: Print Hello

2011-03-17 Thread Don
int n = printf("Hello\n"); int main() { } On Mar 17, 8:08 am, himanshu kansal wrote: > is there any way to print hello in c also wdout writing anythng in > main() > > On Thu, Mar 17, 2011 at 6:34 PM, kunal srivastav > > wrote: > > n...c does not support classes > > > On Thu, Mar 17, 20

[algogeeks] Re: random number generator

2011-03-17 Thread Don
bool uniform() { static bool state = true; state = !state; return state ^ nonuniform(); } On Mar 17, 9:24 am, saurabh agrawal 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.

[algogeeks] Re: A Billion Number Question

2011-03-17 Thread Don
This only works if the file is sorted. If the file starts out with values 5,7,6,... and never contains another 7, the result will be 7, which is in the file. On Mar 17, 12:19 pm, "arpit.gupta" wrote: > read the first no. . > now ans= first no +1; > if now ans is encountered while reading the next

[algogeeks] Re: Google puzzles

2011-03-17 Thread arpit.gupta
ans is n=6, m=36; m= n + (n*7/6 + (n-1)) + ((n*7/6 + (n-1))*7/6 + n-2) +.. now n must be a multiple of 6. taking n=6, we get the answer m= 36 On Mar 16, 3:27 pm, "may.I.answer" wrote: > In a sports contest there were m medals awarded on n successive days > (n > 1). >    1. On the first day 1

[algogeeks] Re: A Billion Number Question

2011-03-17 Thread arpit.gupta
read the first no. . now ans= first no +1; if now ans is encountered while reading the next nos. add 1 to ans. i.e. ans++; On Mar 17, 2:18 am, bittu wrote: > Given an input file with four billion integers, provide an algorithm > to generate an integer which is not contained in the file. Assume

Re: [algogeeks] SPOJ problem-BRCKTS

2011-03-17 Thread bharath kannan
sorry guyz... Had to print YES n NO.. i printed as Yes n No... Got ac.. Sorry for the trouble.. On Wed, Mar 16, 2011 at 10:24 PM, Bharath 2009503507 CSE < bharathgo...@gmail.com> wrote: > i am new to segment trees..i tried this problem in spoj.. > http://www.spoj.pl/problems/BRCKTS > am getting W

Re: [algogeeks] Another maths problem

2011-03-17 Thread Anurag atri
2 On Thu, Mar 17, 2011 at 8:25 PM, saurabh singh wrote: > > > > > Find the smallest divisor of 17^13+13*17... > PS:please dont say 1 > -- > Saurabh Singh > B.Tech (Computer Science) > MNNIT ALLAHABAD > > > > > > -- > Saurabh Singh > B.Tech (Computer Science) > MNNIT ALLAHABAD > > > -- > You rec

Re: [algogeeks] Another maths problem

2011-03-17 Thread abhijith reddy
17^13 is odd 13*17 is odd so isn't the answer simply 2 ? On Thu, Mar 17, 2011 at 8:25 PM, saurabh singh wrote: > > > > > Find the smallest divisor of 17^13+13*17... > PS:please dont say 1 > -- > Saurabh Singh > B.Tech (Computer Science) > MNNIT ALLAHABAD > > > > > > -- > Saurabh Singh > B.Tech

Re: [algogeeks] random number generator

2011-03-17 Thread Rahul Singal
use the function which generate true 60% twice . if first time its true and second time false then its true .(probability .6 x .4 =.24 ) if first time its false and second time true then its false .(probability .4 x .6 =.24 ) rest if it is both true or both false then call the procedure again .(p

[algogeeks] Another maths problem

2011-03-17 Thread saurabh singh
Find the smallest divisor of 17^13+13*17... PS:please dont say 1 -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To p

[algogeeks] random number generator

2011-03-17 Thread saurabh agrawal
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 algog

Re: [algogeeks] Re: 16march

2011-03-17 Thread kavitha nk
gr8.. -- //BE COOL// kavi -- 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 opti

Re: [algogeeks] Re: 10 digit problem

2011-03-17 Thread kavitha nk
> >50 is the answer.. >>> -- //BE COOL// kavi -- 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+u

Re: [algogeeks] A Puzzling Puzzle

2011-03-17 Thread kavitha nk
>i cant get..help me out... >> -- >> //BE COOL// kavi >> > -- 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+unsubsc

Re: [algogeeks] nzec

2011-03-17 Thread kavitha nk
oh 5n.. > > > > > -- > //BE COOL// kavi > -- 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.

Re: [algogeeks] [brain teaser ] 17march

2011-03-17 Thread kavitha nk
lee -- //BE COOL// kavi -- 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 opti

[algogeeks] Look and say sequence

2011-03-17 Thread rohit
'look and say ' (http://oeis.org/A005150) , begins 1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211 , our task is to print this sequence. example: the sequence is: 1, 11 (or one 1), 21 (two 1's), 1211 (one 2, one 1), etc. For the record, each number describes the previous one, using numbers

Re: [algogeeks] Re: Print Hello

2011-03-17 Thread himanshu kansal
is there any way to print hello in c also wdout writing anythng in main() On Thu, Mar 17, 2011 at 6:34 PM, kunal srivastav wrote: > n...c does not support classes > > On Thu, Mar 17, 2011 at 6:10 PM, himanshu kansal < > himanshukansal...@gmail.com> wrote: > >> is this possible in c also?

Re: [algogeeks] Re: Print Hello

2011-03-17 Thread kunal srivastav
n...c does not support classes On Thu, Mar 17, 2011 at 6:10 PM, himanshu kansal < himanshukansal...@gmail.com> wrote: > is this possible in c also > > > On Wed, Mar 16, 2011 at 11:57 PM, Manikanta wrote: > >> Thats right in C++. How about in C. >> >> On Mar 16, 9:44 pm, kumar anurag wrot

Re: [algogeeks] Re: Print Hello

2011-03-17 Thread himanshu kansal
is this possible in c also On Wed, Mar 16, 2011 at 11:57 PM, Manikanta wrote: > Thats right in C++. How about in C. > > On Mar 16, 9:44 pm, kumar anurag wrote: > > @anurag good. > > On Wed, Mar 16, 2011 at 9:28 PM, Anurag atri >wrote: > > > > > > > > > > > > > #include > > > using names

Re: [algogeeks] [brain teaser ] 17march

2011-03-17 Thread Anurag atri
lee ( hint : use those two things that you call eyes :P ) On Thu, Mar 17, 2011 at 2:43 PM, nishaanth wrote: > :P > > > On Thu, Mar 17, 2011 at 10:52 AM, kunal srivastav < > kunal.shrivas...@gmail.com> wrote: > >> lol >> >> >> On Thu, Mar 17, 2011 at 2:20 PM, Srirang Ranjalkar wrote: >> >>> @amit

Re: [algogeeks] [brain teaser ] 17march

2011-03-17 Thread nishaanth
:P On Thu, Mar 17, 2011 at 10:52 AM, kunal srivastav < kunal.shrivas...@gmail.com> wrote: > lol > > > On Thu, Mar 17, 2011 at 2:20 PM, Srirang Ranjalkar wrote: > >> @amit >> have you considered "Lee" as an answer for that question? :P >> >> Thank you, >> Srirang Ranjalkar >> >> -- >> " Luck is wh

Re: [algogeeks] [brain teaser ] 17march

2011-03-17 Thread sitaram jaiswal
lee -- 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

Re: [algogeeks] [brain teaser ] 17march

2011-03-17 Thread amit singh
:D trapped On Thu, Mar 17, 2011 at 2:22 PM, kunal srivastav wrote: > lol > > > On Thu, Mar 17, 2011 at 2:20 PM, Srirang Ranjalkar wrote: > >> @amit >> have you considered "Lee" as an answer for that question? :P >> >> Thank you, >> Srirang Ranjalkar >> >> -- >> " Luck is when hard work meets op

Re: [algogeeks] [brain teaser ] 17march

2011-03-17 Thread kunal srivastav
lol On Thu, Mar 17, 2011 at 2:20 PM, Srirang Ranjalkar wrote: > @amit > have you considered "Lee" as an answer for that question? :P > > Thank you, > Srirang Ranjalkar > > -- > " Luck is when hard work meets opportunity " > > > > On Thu, Mar 17, 2011 at 2:19 PM, amit singh wrote: > >> Lu (hint

Re: [algogeeks] How to print numbers from 1 to 100 without loop , without recursion , without #define statements , without goto statement

2011-03-17 Thread kunal srivastav
class sample { static int count; public: sample(){++count;cout *this is a dump solution > * > > On Thu, Mar 17, 2011 at 12:05 AM, gmagog...@gmail.com > wrote: > >> printf("1 2 3 4 5 6 7 8 9 10 11 12 13..."); >> >> no loop, no recursion, no define, no

Re: [algogeeks] [brain teaser ] 17march

2011-03-17 Thread Srirang Ranjalkar
@amit have you considered "Lee" as an answer for that question? :P Thank you, Srirang Ranjalkar -- " Luck is when hard work meets opportunity " On Thu, Mar 17, 2011 at 2:19 PM, amit singh wrote: > Lu (hint a,e,i ,o,u) > > > On Thu, Mar 17, 2011 at 1:58 PM, Lavesh Rawat wrote: > >> >> *Proble

Re: [algogeeks] [brain teaser ] 17march

2011-03-17 Thread amit singh
Lu (hint a,e,i ,o,u) On Thu, Mar 17, 2011 at 1:58 PM, Lavesh Rawat wrote: > > *Problem Solution* > * > *Lee's parents have five children, the names of the first four are La, Le, > Li, and Lo. > What's the name of the fifth child? > > Update Your Answers at : Click > Here

[algogeeks] [brain teaser ] 17march

2011-03-17 Thread Lavesh Rawat
*Problem Solution* * *Lee's parents have five children, the names of the first four are La, Le, Li, and Lo. What's the name of the fifth child? Update Your Answers at : Click Here Solution: Will be updated after 1 day --

Re: [algogeeks] How to print numbers from 1 to 100 without loop , without recursion , without #define statements , without goto statement

2011-03-17 Thread D.N.Vishwakarma@IITR
*this is a dump solution * On Thu, Mar 17, 2011 at 12:05 AM, gmagog...@gmail.com wrote: > printf("1 2 3 4 5 6 7 8 9 10 11 12 13..."); > > no loop, no recursion, no define, no goto. HAHA : ) > > > > On Wed, Mar 16, 2011 at 12:30 PM, Carl Barton > wrote: > >> @kumar Your example is