Search
Archives
 November 2014 (1)
 April 2012 (1)
 November 2009 (4)
 November 2008 (1)
Information
Categories
 ACM: Ad Hoc (1)
 ACM: graph (1)
 ACM: Greedy Conversion (1)
 ALGORITHM (1)
 Linux (1)
Twitter
Error: Twitter did not respond. Please wait a few minutes and refresh this page.
Meta

Recent Posts
Free book Here
 MySQL High Availability: Tools for Building Robust Data Centers Charles Bell, Mats Kindahl, Lars Thalmann
 jQuery1.2v1.chm
 Cheat Sheet jQuery
 JQuery 1.1 documentation
 jQuery in Action
 Learning jQuery: Better Interaction Design and Web Development with Simple JavaScript Techniques
 Download About Solution of 600 problem By One click
 ACM Solution8
 ACM Solution7
 ACM Solution6
Blog Stats
 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 Top Clicks
 None
Recent Comments
Top Posts
10116: Robot Motion
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.
Example input:
3 6 5
NEESWE
WWWESS
SNWWWW
4 5 1
SESWE
EESNW
NWEEN
EWSEN
0 0 0
Example output:
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= countloop count;
 End
10137: The Trip
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.
The Input
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.
The Output
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.
Sample Input
3 10.00 20.00 30.00 4 15.00 15.01 3.00 3.01 0 
Output for Sample Input
$10.00 $11.99

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....
SWAP TWO VARIABLE WITHOUT THIRD VARIABLE
Do you Know how to swap two variable without third variable?
Answer:
a=10,b=20;
a=^b^=a^=b;//it execute from left a=a^b;b=b^a;a=a^b
//now a=20;b=10
b=a+b(a=b);//execute from right b=20+1010=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=10Any wrong!
Do you Know how to swap three variable without extra variable?
Answer:
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