You are not logged in. Please login at www.codechef.com to post your questions!

×

BS-Editorial

Practice:https://www.codechef.com/problems/BS

Contest:https://www.codechef.com/COVI2018/problems/BS

Author: Chirag Chhabria

Tester: Nitin Pathak

Editorialist: Chirag Chhabria

Difficulty

Cakewalk

Prerequisites

Concept of Profit and Loss

Problem

Find the remaining balance of the user's account if the withdrawal is less than the balance else print the balance

Explanation

The solution only revolves around the condition if their is sufficient balance in the user's account so as to withdraw the given amount after deducting the banking charges. It can be solved with a complexity of O(1)

The testcases can be easily passed by checking two conditions including one where the withdrawal amount is a multiple of 5 or not and if the withdrawal amount plus the bank charges is less than the balance in the account.

Time complexity

O(1)

Space Complexity

O(1)

AUTHOR'S AND TESTER'S SOLUTIONS:

Author's solution can be found http://campus.codechef.com/COVI18TS/viewsolution/19586608/.

Tester's solution can be found http://campus.codechef.com/COVI18TS/viewsolution/19586765/.

asked 20 Aug, 11:27

chikuchhabria's gravatar image

2★chikuchhabria
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×2

question asked: 20 Aug, 11:27

question was seen: 47 times

last updated: 20 Aug, 11:27

Related questions