Connecting Tech Pros Worldwide Help | Site Map

problem with Apples and Mangoes

  #1  
Old November 19th, 2008, 06:15 PM
einstien
Guest
 
Posts: n/a
Let,
A = Apple
M = Mango

Given p apples, and q mangoes take here p =5, q= 6

and arrangement like this AAMMAMMAMAM,

have to change them like this

AM AM AM AM AM M

or

MA MA MA MA MA M

in simple, arranging the couples,writing remaining as individual.

{ here is the condition
reversing them has to give the original arrangement}

Thanks.
  #2  
Old November 19th, 2008, 07:25 PM
blargg
Guest
 
Posts: n/a

re: problem with Apples and Mangoes


einstien <azeez541@gmail.comwrote:
Quote:
Let,
A = Apple
M = Mango
>
Given p apples, and q mangoes take here p =5, q= 6
>
and arrangement like this AAMMAMMAMAM,
>
have to change them like this
>
AM AM AM AM AM M
>
or
>
MA MA MA MA MA M
>
in simple, arranging the couples,writing remaining as individual.
>
{ here is the condition
reversing them has to give the original arrangement}
>
Thanks.
Let,
P = your post
R = someone reading your post

P R

Result: Reader can find no question in your post.

You're welcome.
  #3  
Old November 19th, 2008, 08:05 PM
user923005
Guest
 
Posts: n/a

re: problem with Apples and Mangoes


On Nov 19, 10:13*am, einstien <azeez...@gmail.comwrote:
Quote:
Let,
A = Apple
M = Mango
>
Given p apples, and q mangoes take *here p =5, q= 6
>
and arrangement like this AAMMAMMAMAM,
>
have to change them like this
>
AM AM AM AM AM * * M
>
or
>
MA MA MA MA MA * * M
>
in simple, arranging the couples,writing *remaining *as individual.
>
{ here is the condition
reversing them has to give the original arrangement}
>
Smells like a sort/merge to me.
Or, in this case, with only two distinct items, create two auxiliary
lists.
Separate all M into list one.
Separate all A into list two.
Merge the distinct lists back into the original list.

I am sure that there are plenty of other solutions.

P.S.
You want news:comp.programming and not news:comp.lang.c because your
post contains not even a hint of a C question.
  #4  
Old November 19th, 2008, 08:15 PM
cnoe
Guest
 
Posts: n/a

re: problem with Apples and Mangoes


On Nov 20, 1:03*am, user923005 <dcor...@connx.comwrote:
Quote:
On Nov 19, 10:13*am, einstien <azeez...@gmail.comwrote:
>
>
>
Quote:
Let,
A = Apple
M = Mango
>
Quote:
Given p apples, and q mangoes take *here p =5, q= 6
>
Quote:
and arrangement like this AAMMAMMAMAM,
>
Quote:
have to change them like this
>
Quote:
AM AM AM AM AM * * M
>
Quote:
or
>
Quote:
MA MA MA MA MA * * M
>
Quote:
in simple, arranging the couples,writing *remaining *as individual.
>
Quote:
{ here is the condition
reversing them has to give the original arrangement}
>
Smells like a sort/merge to me.
Or, in this case, with only two distinct items, create two auxiliary
lists.
Separate all M into list one.
Separate all A into list two.
Merge the distinct lists back into the original list.
>
I am sure that there are plenty of other solutions.
>
P.S.
You want news:comp.programming and not news:comp.lang.c because your
post contains not even a hint of a C question.
ok I 'll post there.
Thanks.
  #5  
Old November 19th, 2008, 09:05 PM
Flash Gordon
Guest
 
Posts: n/a

re: problem with Apples and Mangoes


cnoe wrote, On 19/11/08 19:37:
Quote:
On Nov 20, 12:20 am, blargg....@gishpuppy.com (blargg) wrote:
Quote:
>einstien <azeez...@gmail.comwrote:
<snip>
Quote:
Any more information please ask it.
There are two pieces of information I would like.

1) Why don't you post with a consistent name.
2) Why do you think other people should do your homework for you?
--
Flash Gordon
If spamming me sent it to smap@spam.causeway.com
If emailing me use my reply-to address
See the comp.lang.c Wiki hosted by me at http://clc-wiki.net/
  #6  
Old November 19th, 2008, 09:25 PM
Chris M. Thomasson
Guest
 
Posts: n/a

re: problem with Apples and Mangoes


"Eric Sosman" <Eric.Sosman@sun.comwrote in message
news:1227126336.137545@news1nwk...
[...]
Quote:
#define FRUIT "M M M M A A M M M A M"
#include <stdio.h>
#include <string.h>
#define Oo(O) putchar(O)
#define O(o,O) o=(Oo(*o++),oO(o,O,o),o)
#define oO(OO,oo,o) OO=strchr(o,oo)
int main(void){char*oO(Oo,'A',FRUIT),*oO(oO,'M',FRUIT)
;while(Oo&&oO){O(Oo,'A');O(oO,'M');if(Oo&&oO)Oo(' ');}
if(Oo||oO)Oo('\t');while(Oo){O(Oo,'A');if(Oo)Oo(' ');}
while(oO){O(oO,'M');if(oO)Oo(' ');}Oo('\n');return 0;}
=^D

  #7  
Old November 19th, 2008, 10:05 PM
Andrey Tarasevich
Guest
 
Posts: n/a

re: problem with Apples and Mangoes


Eric Sosman wrote:
Quote:
#define FRUIT "M M M M A A M M M A M"
#include <stdio.h>
#include <string.h>
#define Oo(O) putchar(O)
#define O(o,O) o=(Oo(*o++),oO(o,O,o),o)
#define oO(OO,oo,o) OO=strchr(o,oo)
int main(void){char*oO(Oo,'A',FRUIT),*oO(oO,'M',FRUIT)
;while(Oo&&oO){O(Oo,'A');O(oO,'M');if(Oo&&oO)Oo(' ');}
if(Oo||oO)Oo('\t');while(Oo){O(Oo,'A');if(Oo)Oo(' ');}
while(oO){O(oO,'M');if(oO)Oo(' ');}Oo('\n');return 0;}
Mmmmaaammmmaa mia!

--
Best regards,
Andrey Tarasevich
  #8  
Old November 19th, 2008, 10:55 PM
blargg
Guest
 
Posts: n/a

re: problem with Apples and Mangoes


Chris M. Thomasson wrote:
Quote:
"Eric Sosman" <Eric.Sosman@sun.comwrote in message
news:1227126336.137545@news1nwk...
[...]
Quote:
#define FRUIT "M M M M A A M M M A M"
#include <stdio.h>
#include <string.h>
#define Oo(O) putchar(O)
#define O(o,O) o=(Oo(*o++),oO(o,O,o),o)
#define oO(OO,oo,o) OO=strchr(o,oo)
int main(void){char*oO(Oo,'A',FRUIT),*oO(oO,'M',FRUIT)
;while(Oo&&oO){O(Oo,'A');O(oO,'M');if(Oo&&oO)Oo(' ');}
if(Oo||oO)Oo('\t');while(Oo){O(Oo,'A');if(Oo)Oo(' ');}
while(oO){O(oO,'M');if(oO)Oo(' ');}Oo('\n');return 0;}
>
=^D
Given the macros, I think a more appropriate emoticon is

o_O
  #9  
Old November 19th, 2008, 11:25 PM
Default User
Guest
 
Posts: n/a

re: problem with Apples and Mangoes


blargg wrote:

Quote:
Given the macros, I think a more appropriate emoticon is
>
o_O

You should get that looked at.




Brian
  #10  
Old November 20th, 2008, 01:45 AM
CBFalconer
Guest
 
Posts: n/a

re: problem with Apples and Mangoes


blargg wrote:
Quote:
einstien <azeez541@gmail.comwrote:
>
Quote:
>Let,
>A = Apple
>M = Mango
>>
>Given p apples, and q mangoes take here p =5, q= 6
>and arrangement like this AAMMAMMAMAM,
>have to change them like this
>>
>AM AM AM AM AM M
>or
>MA MA MA MA MA M
>>
>in simple, arranging the couples,writing remaining as individual.
>>
>{ here is the condition
>reversing them has to give the original arrangement}
>
Let,
P = your post
R = someone reading your post
>
P R
>
Result: Reader can find no question in your post.
He doesn't need to post a question. However Reader also can find
no information in the post.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
Closed Thread