Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

A satisfiability problem

 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got this in the mail yesterday. Its not too difficult but is a nice little puzzle that helps you to exercise your problem solving abilities.


You are chief of protocol for the embassy ball. The crown prince instructs you either to invite Peru or Slovenia or exclude Qatar. The queen asks you to invite either Qatar or Romania. The king, in a spiteful mood, wants to snub either Romania or Peru or both. The prime minister calls to say if the Peruvian ambassador meets the Romanian amabassador a fistfight is bound to break out.Make a guest list that will satisfy the whims of the entire royal family and avoid an unpleasant incident at the ball?


[This message has been edited by Sahir Shibley (edited June 07, 2001).]
 
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Invite noone. Technically, that satisfies the requirements, but I have a sneaking suspicion it's not the answer you are looking for.
When you say OR do you mean either or (|) or exclusive OR (^)?
Paul R
[This message has been edited by Paul Ralph (edited June 07, 2001).]
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so based on your saying:
P peru
S slovenia
Q qatar
R romania
crown: P | S | ~Q
queen: Q | R | ~S
king ~R | ~P
minister: P xor R
only P xor R are a most condition, so you can only invite one of them. You can invite R or S or both.
did I understand it right?
 
Sahir Shibley
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul,
No guests means no party. However I have modified the question to exclude that possibility. The queen's instruction is now to invite Qatar or Romania so you must invite one of them to make her happy.
Cynthia,
It does not matter if its | or ^. Because he is just telling you if you have one you cant have the other.

[This message has been edited by Sahir Shibley (edited June 07, 2001).]
 
Paul Ralph
Ranch Hand
Posts: 316
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still don't get it. In particular, the prime minister's request makes the king's request redundant or vice versa. Is there supposed to be only one solution or do you have to invite the most possible? Again, could you clarify the "OR"?
Would the crown prince be OK with inviting Peru and Slovenia, for example? My best guess is 1. Peru and Qatar 2. Slovenia and Qatar 3. Slovenia and Romania
If you include the Queen's last request, that eliminates possibility 1 but I'm still missing something.
Paul R
 
Ranch Hand
Posts: 233
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


so based on your saying:
P peru
S slovenia
Q qatar
R romania
crown: P | S | ~Q
queen: Q | R | ~S
king ~R | ~P
minister: P xor R
Originally posted by Cynthia Yao


My attempt:

Looks like Slovenia and Qatar are going to the ball to me.
Slovenia because noone said not to invite them. And Qatar because it would only be excluded if neither Slovenia or Pure were not invited; however, Slovenia was invited.
crown's happy Slovenia and Qatar are invited.
queen's happy Qatar is invited.
king's happy he gets to snub both Romania and Pure.
minister's happy because neither Romania or Pure is invited so there's no duking it out.
 
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Why not Peru and Qatar?
Prince is happy cause you invited Peru.
Queen is happy that you invited Qatar.
King got to snub Romania.
Prime Minister doesn't have to see any fights.
Or
Slovenia and Romania
Prince gets to invite Slovenia.
Queen gets to invite Romania.
King snubs Peru.
Minister no fighting.

No unique answer. . .seems like there must be something missing? What answer do you have Sahir?
 
Sheriff
Posts: 15767
264
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Invite China, Taiwan and the US and let the good times roll!
Slovenia and Romania, too.

[This message has been edited by JUNILU LACAR (edited June 07, 2001).]
 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just invite ROMANIA and enjoy your party!
 
Sahir Shibley
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Andrew Shafer:
No unique answer. . .seems like there must be something missing? What answer do you have Sahir?



Both are right. I did not say there was only one possible solution.
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Invite them all, then sit back and watch the fun!!
 
Andrew Shafer
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ahhh yeah, a pay-per-view. . .
In this corner, weighing in at a 130 lbs, the dignitary from Peru. ..
 
I wasn't selected to go to mars. This tiny ad got in ahead of me:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic