Social Icons

twitterfacebookgoogle pluslinkedinrss feedemail

Saturday, August 11, 2012

BUBTPC-1st Problem K - Morning Walk


Problem K
Morning Walk
Standard Input/Output
Time limit: 1sec

Problem Description:
Mr. Bari lives in the city of peace. Here every person and every property have some definite rules and almost all of them follow those rules strictly. Every day Mr. Bari wakes up early in the morning as morning walk is good for health.  Every morning Mr. Bari used to walk on the road which goes from just in front of his house. The road also has some property! When Mr. Bari starts his morning walk then in his left side all the house numbers are odd and on his right side all the house numbers are even. While coming back this property is reversed.  So when Mr. Bari starts his walk then the first house in this left side is 1, second one is 3etc. And in the right side the first house is 2, second one is 4 etc. In this problem you are to help Mr. Bari by helping him to know about the house number of any house whether his left or right.
Input:
A complete input set contains many test cases. Each test cases contains there integer M (1<=M<=100), N (0<=N<=1), and H (1<=H<100) separated by space. Where M indicates the total houses that are in the left side of Mr. Bari, there are also M houses on his right. N indicates whether he is going from home or coming home. If N is 0 then he is going and if N is 1 then he is coming back to home. Then the last number H will indicate his position.
Output:
For every test case output two integer separated by a space. The first number will indicate the house number on the left side of Mr. Bari and the second one will indicate the house number on right side.
Sample Input
Sample Output
5 0 1
5 0 3
5 1 1
1 2
5 6
20 19



 

No comments:

Post a Comment

 

Sample text

Sample Text