Error: Twitter did not respond. Please wait a few minutes and refresh this page.
- MySQL High Availability: Tools for Building Robust Data Centers Charles Bell, Mats Kindahl, Lars Thalmann
- Cheat Sheet -jQuery
- JQuery 1.1 documentation
- jQuery in Action
- Download About Solution of 600 problem By One click
- ACM Solution-8
- ACM Solution-7
- ACM Solution-6
- 3,271 hits
MY HEAVEN CALENDER
March 2017 M T W T F S S « Nov 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions are
N north (up the page)
S south (down the page)
E east (to the right on the page)
W west (to the left on the page)
For example, suppose the robot starts on the north (top) side of Grid 1 and starts south (down). The path the robot follows is shown. The robot goes through 10 instructions in the grid before leaving the grid.
Compare what happens in Grid 2: the robot goes through 3 instructions only once, and then starts a loop through 8 instructions, and never exits.
You are to write a program that determines how long it takes a robot to get out of the grid or how the robot loops around.
There will be one or more grids for robots to navigate. The data for each is in the following form. On the first line are three integers separated by blanks: the number of rows in the grid, the number of columns in the grid, and the number of the column in which the robot enters from the north. The possible entry columns are numbered starting with one at the left. Then come the rows of the direction instructions. Each grid will have at least one and at most 10 rows and columns of instructions. The lines of instructions contain only the characters N, S, E, or W with no blanks. The end of input is indicated by a row containing 0 0 0.
For each grid in the input there is one line of output. Either the robot follows a certain number of instructions and exits the grid on any one the four sides or else the robot follows the instructions on a certain number of locations once, and then the instructions on some number of locations repeatedly. The sample input below corresponds to the two grids above and illustrates the two forms of output. The word “step” is always immediately followed by “(s)” whether or not the number before it is 1.
3 6 5
4 5 1
0 0 0
10 step(s) to exit
3 step(s) before a loop of 8 step(s)
- First you have to input correctly.
- Take two array on is indicate input array other array element represent movement number.
- If out of col or row then only print count step
- Otherwise count -arry count current position value -1
- And count= count-loop count;
A number of students are members of a club that travels annually to exotic locations. Their destinations in the past have included Indianapolis, Phoenix, Nashville, Philadelphia, San Jose, and Atlanta. This spring they are planning a trip to Eindhoven.
The group agrees in advance to share expenses equally, but it is not practical to have them share every expense as it occurs. So individuals in the group pay for particular things, like meals, hotels, taxi rides, plane tickets, etc. After the trip, each student’s expenses are tallied and money is exchanged so that the net cost to each is the same, to within one cent. In the past, this money exchange has been tedious and time consuming. Your job is to compute, from a list of expenses, the minimum amount of money that must change hands in order to equalize (within a cent) all the students’ costs.
Standard input will contain the information for several trips. The information for each trip consists of a line containing a positive integer, n, the number of students on the trip, followed by n lines of input, each containing the amount, in dollars and cents, spent by a student. There are no more than 1000 students and no student spent more than $10,000.00. A single line containing 0 follows the information for the last trip.
For each trip, output a line stating the total amount of money, in dollars and cents, that must be exchanged to equalize the students’ costs.
|Output for Sample Input
1. If (currentStudentPayment > averagePayment) positiveDifference += currentStudentPayment - averagePayment; Else negativeDifference += averagePayment - currentStudentPayment; if(negativeDifference > positiveDifference) return negativeDifference else return positiveDifference
2. Here negative or positive difference must be int which is the tic of this problem....
Do you Know how to swap two variable without third variable?
a=^b^=a^=b;//it execute from left a=a^b;b=b^a;a=a^b
b=a+b-(a=b);//execute from right b=20+10-10=20; a=b=10;
//now a=10 b=20
b=(a*b)/(a=b); //similarly b=10*20/20; a=b=20;
//now a=20 b=10
Do you Know how to swap three variable without extra variable?
a = a + b + c;
b = a – (b + c);//b=a
c = a – (b + c);//c=b here b mean initial b, in operation b=a
a = a – (b + c);//a=c here c mean initial b, in operation b=a,c=b