Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
어느게 빠른가
(version: 0)
Comparing performance of:
a vs b
Created:
4 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
function calculateChange(payment, cost) { let change = payment - cost; let money = [50000, 10000, 5000, 1000]; // 5만, 1만, 5천, 1천 let moneyResult = [0, 0, 0, 0]; for(let i= 0; i < money.length; i++) { if(change <= 0) break; if(change / money[i] > 0){ let temp = Math.floor(change / money[i]); moneyResult[i] = temp; change = change % money[i]; } } console.log(`50000원 지폐: ${moneyResult[0]}장`); console.log(`10000원 지폐: ${moneyResult[1]}장`); console.log(`5000원 지폐: ${moneyResult[2]}장`); console.log(`1000원 지폐: ${moneyResult[3]}장`); }
Tests:
a
calculateChange(100000, 33000);
b
calculateChange(500000, 378000);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
a
b
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
gemma2:9b
, generated one year ago):
This benchmark measures the performance of calculating change in Korean currency. It simulates giving money to a cashier and determining how many banknotes (of different denominations) are needed as change. **Here's a breakdown:** * **The Problem:** The `calculateChange` function takes two numbers: `payment` (the amount paid) and `cost` (the price of the item). It then calculates the correct number of 50,000 won, 10,000 won, 5,000 won, and 1,000 won banknotes needed for the change. * **Options Compared:** There's only one algorithm implemented in this benchmark. It iterates through each denomination and calculates how many notes are needed from largest to smallest. The code is optimized slightly by breaking out of the loop when the `change` becomes zero or negative. * **Pros/Cons:** * **Simplicity:** This approach is easy to understand and implement. * **Efficiency (For this case):** It's efficient because it only iterates through the denominations once. * **Alternatives:** There are other ways to calculate change, such as: * **Greedy Algorithm:** Start with the largest denomination and work down, always using the maximum number of notes possible. This might not always be optimal in terms of minimizing the total number of notes used but it's generally faster. * **Dynamic Programming:** For more complex scenarios (different denominations, finding the minimum number of notes), dynamic programming can be used to find the most efficient solution. **Key Considerations:** * **Currency System:** The benchmark is specifically tailored to Korean currency denominations. Let me know if you have any other questions about this benchmark or would like a deeper dive into any of these concepts!
Related benchmarks:
어느게 빠른가d
어느게 빠른가dd
dfdfddddd
min check - 2
Comments
Confirm delete:
Do you really want to delete benchmark?