-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTwo Gangsters Explanation.txt
23 lines (17 loc) · 1.19 KB
/
Two Gangsters Explanation.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Two gangsters Harry and Larry had a rest at countryside. They decided to spend some time shooting, so they put several beer cans (no more than 10) on a log.
Harry started to shoot cans one after another from the leftmost to the right and Larry – from the rightmost to the left.
At some moment it happened so that they shot one and the same can.
Harry got indignant and claimed that Larry owed him a considerable sum of money because Larry deprived him of shooting some more cans.
Larry became furious and told Harry that he owed even greater sum of money to Larry because of the same reason.
They started to argufy but nobody remembered how many cans there were at the very beginning. And no one of them was going to search cans which was shot.
Anyway, each of them remembered exactly how many cans he shot.
Determine how many cans were not shot by Harry and how many cans were not shot by Larry.
----------------------------------------
Each person misses out on all the cans the other person shot, but one (Which was common)
int main()
{
int harry_cans, larry_cans;
scanf("%d %d", &harry_cans, &larry_cans);
printf("%d %d\n", larry_cans - 1, harry_cans - 1);
return 0;
}