https://github.com/leodeveloper/paint-shop
Paint Shop code challenge
https://github.com/leodeveloper/paint-shop
Last synced: about 1 year ago
JSON representation
Paint Shop code challenge
- Host: GitHub
- URL: https://github.com/leodeveloper/paint-shop
- Owner: leodeveloper
- Created: 2017-11-28T23:57:49.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-29T13:31:49.000Z (over 8 years ago)
- Last Synced: 2023-12-08T11:41:03.270Z (over 2 years ago)
- Language: C#
- Homepage:
- Size: 270 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Paint Shop code challenge
by Muhammad Suleman
** Specification:
You run a paint shop, and there are a few different colors of paint you can prepare. Each color can be either "gloss" or "matte". You have a number of customers, and each have some colors they like, either gloss or matte.
No customer will like more than one color in matte. You want to mix the colors, so that:
There is just one batch for each color, and it's either gloss or matte.
For each customer, there is at least one color they like.
You make as few mattes as possible (because they are more expensive). Your program should accept an input file as a command line argument, and print a result to standard out. An example input file is:
5 1 M 3 G 5 G 2 G 3 M 4 G 5 M
The first line specifies how many colors there are. Each subsequent line describes a customer. For example, the first customer likes color 1 in matte, color 3 in gloss and color 5 in gloss. Your program should read an input file like this, and print out either that it is impossible to satisfy all the customer, or describe, for each of the colors, whether it should be made gloss or matte. The output for the above file should be:
G G G G M
...because all customers can be made happy by every paint being prepared as gloss except number 5. An example of a file with no solution is:
1 1 G 1 M
Your program should print
No solution exists
A slightly richer example is:
5 2 M 5 G 1 G 5 G 1 G 4 M 3 G 5 G 3 G 5 G 1 G 3 G 2 M 5 G 1 G 2 M 5 G 4 M 5 G 4 M
...which should print:
G M G M G
One more example. The input:
2 1 G 2 M 1 M
...should produce
M M
** Running
Go release folder in the command propmt
Example run in command line: drive:\Release>PaintShop testfile.txt
there are four other testfile available inside the release folder.