In the dormitory, people will take turns to buy dinner or stuff for dinner. Each night…
- User
In the dormitory, people will take turns to buy dinner or stuff for dinner. Each night one person goes out to buy and writes details of it on the "Detail Paper". Details include the name of the buyer, the amount of money he/she paid and the name of the people who ate that night.
Description of the image
At the end of each month everyone has to pay their debts, but everyone gets so creepy when it comes to money. So they all decided to hire a team from ACM (Abdominal Control Market) of the SBU University. you are one of the teams participating in ACM Newbies Contest so you have to help them. They only have two rules:
Only people that ate, should pay (name of them is written in Detail Paper) The money paid by everyone on each night must be equal. input There are some test cases in one test (at most 200), each test case contains an integer L ( L ≤ 50 ) L(L≤50), number of lines to follow. Each line of test case is as follows: A string S S name of the buyer followed by an integer c ( 0 < c < 100,000 ) C(0<C<100000) cost of things bought followed by an integer N ( N ≤ 10 ) N(N≤10), indicating how many people ate that specific night, following N N space separated strings indicating n a m e name of the people that ate that night. It's guaranteed that c C is divisible by N N and Each line contains no more than 250 250 characters. Each N a m e Name contains "A-Z" and "a-z" characters. N a m e s Names are NOT case-sensitive and the length of each name is at most 20 characters. (Case-Sensitive: 'a' ≠ 'A', not case-sensitive: 'a' = 'A')
output For each test case output "Case #X:" (quotations for clarification) which X X is the number of test cases. Then print "Debtors:" (quotations for clarification) and in each line print name of debtors and their liability as follows sorted by debtors name in alphabetical order:
S owes D Tomans.
First alphabetical character of S S must be uppercase and rest of alphabetical characters must be lowercase, d D is an integer number (money person S S must pay). Then print "Creditors:" (quotations for clarification) and in each line print name of creditors and their credit as follows sorted by creditors name in alphabetical order:
S paid D Tomans.
First alphabetical character of S S must be uppercase and rest of alphabetical characters must be lowercase, d D is an integer number (money person S S must get). People who don't have to pay or receive any money are neither Debtor nor Creditor, so their name should not appear in output.
examples Sample entry 1 10 Michel 9200 4 Aden John David Michel Ashley 8700 3 Ashley Aden John Ashley 6000 3 Michael John Ashley Aden 15000 3 Ashley John Aden Michel 1800 4 Aden David Michel Ashley David 2200 4 Aden John David Ashley Aden 29400 3 Aden David Ashley Aden 8500 4 Aden David Ashley John John 21000 3 Aden Michel John Aden 3100 2 Aden Michel 1 Ehsan 4500 1 Ehsan Plain text Sample output 1 Case #1: Debtors: Ashley owes 8125 Tomans. David owes 13025 Tomans. John owes 875 Tomans. Michel owes 2300 Tomans. Creditors: Aden paid 24325 Tomans. Case #2: Debtors: Creditors: write in c++
- Assistant