problem with Apples and Mangoes | | |
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. | | | | 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. | | | | 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. | | | | 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:
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. | | | | 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/ | | | | 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 | | | | 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 | | | | 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 | | | | 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 | | | | 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. |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,376 network members.
|