Problem Statement: Lumberjack Sequencing
Explanation
Do a simple checking everytime you got an input to check whether the series ordered or not.
Source Code
Coding Quest
Minggu, 22 Januari 2017
Kamis, 19 Januari 2017
SPOJ 7974 - ACPC10A Solution
Problem Statement: What's Next
Explanation
Do a addition and multiplication to decide if the sequence is arithmetic or geometric.
Source Code
Explanation
Do a addition and multiplication to decide if the sequence is arithmetic or geometric.
Source Code
Selasa, 17 Januari 2017
UVA 12502 - Three Families Solution
Problem Statement: Three Families
Explanation
Let's do a simple simulation from the problem statement to get a better problem understanding. Family A spent 5 hours and family B spent 4 hours to finish the job, so total hours needed to finish the job is 9 hours. Divide the total hours by 3 and result is 9 / 3 = 3. So normally every family must do 3 hours to finish the job.
Because family A do 5 hours job, it means family A do 5 - 3 = 2 extra hours. Meanwhile family B do 1 extra hours. To calculate money that family A get (2 / (2 + 1)) * 90 = 60.
Source Code
Explanation
Let's do a simple simulation from the problem statement to get a better problem understanding. Family A spent 5 hours and family B spent 4 hours to finish the job, so total hours needed to finish the job is 9 hours. Divide the total hours by 3 and result is 9 / 3 = 3. So normally every family must do 3 hours to finish the job.
Because family A do 5 hours job, it means family A do 5 - 3 = 2 extra hours. Meanwhile family B do 1 extra hours. To calculate money that family A get (2 / (2 + 1)) * 90 = 60.
Source Code
Minggu, 15 Januari 2017
UVA 11875 - Brick Game Solution
Problem Statement: Brick Game
Explanation
Because the input always given in increasing or decreasing order and each teams consists of odd number of players, so the answer is the value in the middle of array.
Source Code
Explanation
Because the input always given in increasing or decreasing order and each teams consists of odd number of players, so the answer is the value in the middle of array.
Source Code
UVA 10469 - To Carry or not to Carry Solution
Problem Statement: To Carry or not to Carry
Explanation
Convert the input to binary and add both binary. Everytime you add a different bit (0 + 1 or 1 + 0) add the decimal value that represent the bit to the result.
Source Code
Explanation
Convert the input to binary and add both binary. Everytime you add a different bit (0 + 1 or 1 + 0) add the decimal value that represent the bit to the result.
Source Code
Sabtu, 14 Januari 2017
UVA 10696 - f91 Solution
Problem Statement: f91
Explanation
Implement the recursion defined in the problem statement.
Source Code
Explanation
Implement the recursion defined in the problem statement.
Source Code
UVA 11805 - Bafana Bafana Solution
Problem Statement: Bafana Bafana
Explanation
Where N is the number of players practicing, K the player that receive the ball first, and P the number of passes that need to be done. Follow these step to find the last player who receive the ball.
Explanation
Where N is the number of players practicing, K the player that receive the ball first, and P the number of passes that need to be done. Follow these step to find the last player who receive the ball.
- P = P % N
- K = K + P
- K = K % N
- If K equal 0 then set K to the value of N, else just stick to the current value.
Source Code
Langganan:
Postingan (Atom)