[algogeeks]
3 8 12 17 22 28 35 .. find the nth term of the sequence -- pardeep kumar -- 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 :STAMPS
use if(sum wrote: > @MAYANK your output format is wrong.use printf("\nScenario #%d:\n",(i+1)); > and > if(sum On Thu, Jun 21, 2012 at 12:34 PM, Mayank Singh < > singh13490may...@gmail.com> wrote: > >> here is my code >> /*#include >> #include >> >> int main() >> { >> int cand,sum; >> int T,N,i,j,temp[10]; >> scanf("%d",&T); >> >> sum = 0; >> for(i=0;i> { >> scanf("%d",&N); >> for(j=0;j> { >> scanf("%d",&cand); >> sum = (sum+cand)%N; >> } >> if(sum == 0) >> temp[i]=1; >> else >> temp[i]=0; >> } >> for(i=0;i> { >> if(temp[i]==1) >> printf("YES\n"); >> else >> printf("NO\n"); >> } >> return 0; >> }*/ >> >> #include >> #include >> >> int main() >> { >> int t,frd,i,j,arr[1],sum,k,arr1[10],p; >> scanf("%d",&t); >> long int sta; >> for(i=0;i> { >> scanf("%ld",&sta); >> scanf("%d",&frd); >> for(j=0;j> { >> scanf("%d",&arr[j]); >> } >> for(j=0;j> { >> for(k=0;k> { >> if(arr[k]> { >> sum = arr[k]; >> arr[k] = arr[k+1]; >> arr[k+1] = sum; >> } >> } >> } >> >> sum = 0; >> p=0; >> for(k=0;k> { >> if(sum <= sta) >> { >> sum = sum+arr[k]; >> p++; >> } >> else >> break; >> } >> if(sum < sta) >> arr1[i] = 0; >> else >> arr1[i] = p; >> } >> for(i=0;i> { >> printf("\nScenario #%d\n:",(i+1)); >> if(arr1[i] == 0) >> printf("impossible\n"); >> else >> printf("%d\n",arr1[i]); >> } >> return 0; >> } >> >> i am getting WA . plz help me... >> >> thanx >> >> -- >> 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. >> > > > > -- > pardeep kumar > -- pardeep kumar -- 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 :STAMPS
@MAYANK your output format is wrong.use printf("\nScenario #%d:\n",(i+1)); and if(sum wrote: > here is my code > /*#include > #include > > int main() > { > int cand,sum; > int T,N,i,j,temp[10]; > scanf("%d",&T); > > sum = 0; > for(i=0;i { > scanf("%d",&N); > for(j=0;j { > scanf("%d",&cand); > sum = (sum+cand)%N; > } > if(sum == 0) > temp[i]=1; > else > temp[i]=0; > } > for(i=0;i { > if(temp[i]==1) > printf("YES\n"); > else > printf("NO\n"); > } > return 0; > }*/ > > #include > #include > > int main() > { > int t,frd,i,j,arr[1],sum,k,arr1[10],p; > scanf("%d",&t); > long int sta; > for(i=0;i { > scanf("%ld",&sta); > scanf("%d",&frd); > for(j=0;j { > scanf("%d",&arr[j]); > } > for(j=0;j { > for(k=0;k { > if(arr[k] { > sum = arr[k]; > arr[k] = arr[k+1]; > arr[k+1] = sum; > } > } > } > > sum = 0; > p=0; > for(k=0;k { > if(sum <= sta) > { > sum = sum+arr[k]; > p++; > } > else > break; > } > if(sum < sta) > arr1[i] = 0; > else > arr1[i] = p; > } > for(i=0;i { > printf("\nScenario #%d\n:",(i+1)); > if(arr1[i] == 0) > printf("impossible\n"); > else > printf("%d\n",arr1[i]); > } > return 0; > } > > i am getting WA . plz help me... > > thanx > > -- > 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. > -- pardeep kumar -- 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] c prog problem
102 102 -90 64 On Thu, Jun 14, 2012 at 10:48 AM, Anika Jain wrote: > in this by typecasting address of float a to char * u assign the address > of a to ptr. but as ptr is a character pointer when *ptr is printed only 1 > byte currently pointed by ptr is pointed. when ptr is incremented it points > to the next higher higher order byte of "a". by this way all bytes of "a" > are printed using a character pointer > > On Wed, Jun 13, 2012 at 11:47 PM, Rahul verma wrote: > >> int main() >> { >> int i; >> float a=5.2; >> char *ptr; >> ptr=(char *)&a; >>for(i=0;i<=3;i++) >> printf("%d ",*ptr++); >> return 0; >> } >> give me explanation of this code. >> >> -- >> 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 > Anika Jain > > -- > 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. > -- pardeep kumar -- 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] C OUTPUT
number will be sored in 2'scomplement form .as 4=100 so its 1's comlement form will be 011 and adding 1 to it will result in 011+1=100.so -4 will be printed On Wed, Sep 21, 2011 at 10:23 AM, kartik sachan wrote: > @ravi i think ur concepts is correct the no is stored in 2's formif > negative > > thanks ravi > > -- > 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] Find the output
it will print 2,5 On Fri, Sep 16, 2011 at 2:35 AM, Brijesh wrote: > >> > On Friday, 16 September 2011 13:25:38 UTC+5:30, Anup wrote: >> >> #include >> int main() >> { >> int a[5]={1,2,3,4,5}; >> int *ptr=(&a + 1); >> >int *ptr=(int *)(&a + 1); > >> printf("%d %d\n",*(a+1),*(ptr-1)); >> return 0; >> } >> >> Find the output! >> > > Now it will print 2 5 > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/4tXlbiojgm8J. > > 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] A logical Question
it will be same bcz the suitcase was already with him. On Thu, Sep 15, 2011 at 1:32 AM, UTKARSH SRIVASTAV wrote: > hi it;s a physics question of t bouyant force > > > On Thu, Sep 15, 2011 at 1:53 PM, sagar pareek wrote: > >> it depends that weather boat is on the water or not :P >> >> >> On Thu, Sep 15, 2011 at 12:58 PM, Tamanna Afroze wrote: >> >>> >>> *If you are on a boat and you throw out a suitcase, Will the level of >>> water increase.* >>> >>> -- >>> 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 >> SAGAR PAREEK >> COMPUTER SCIENCE AND ENGINEERING >> NIT 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. >> > > > > -- > *UTKARSH SRIVASTAV > CSE-3 > B-Tech 3rd Year > @MNNIT 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.
Re: [algogeeks] Re: spoj--two squares problem
use long long int instead of int for X and all except t.and type cast the sqrt returned value to integer..like int(sqrt(X)) On Sun, May 29, 2011 at 1:55 PM, Vishal Jain wrote: > Hi Saurabh, > > Can you try it for 10? Could not really understand, what are you gonna > communicate? > > 10 = 2*5 (2^2 + 1^2 )*(1*2 + 1^2)... If with this logic you are saying 10 > is prime then all numbers divisible by 5 should be prime. > > Could you elaborate your answer more? > > Thanks & Regards > Vishal Jain > MNo: +91-9540611889 > Tweet @jainvis > Blog @ jainvish.blogspot.com > Success taste better when target achieved is bigger. > > P *We have a responsibility to the environment.* > > *Before printing this e-mail or any other document, let's ask ourselves > whether we need a hard copy.* > > > > > On Sun, May 29, 2011 at 6:46 AM, saurabh singh wrote: > >> In fact we can...though not directly..SInce every number can be broken >> down as facotrs of primeUse that property >> >> >> On Sun, May 29, 2011 at 1:12 AM, Tushar Bindal wrote: >> >>> that theorem is for odd primes >>> 9 is not an odd prime >>> so we can;t apply this theorem >>> >>> >>> -- >>> 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. >>> >> >> >> >> -- >> Saurabh Singh >> B.Tech (Computer Science) >> MNNIT 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.