New Banking System
Practice
0 (0 votes)
Medium
Problem
42% Success 38 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

In a new banking system, interest is calculated in the following manner. Let A be the total amount in the account of account-holder of the bank. And p be no of times an account-holder has deposited cash , and q be no of times he withdrew cash from the time of creation of his account till date. Then, interest =(Amount left in account)*[ min((2^p / 3^q), 0.1)]; Interest is calculated every 12 months.

Given details of timeline of events for an account. The given details is in ascending order of no of months elapsed since creation of account. Calculate amount left in the account at end of last transaction term.

A: amount with which bank account was opened N: No of transcations made X: No of Months passed after creation of account Y: Transaction Amount

If Y is positive, amount was deposited, if Y is negative, amount was withdrawn

Total Amount in account is always non-negative value.

Input : First line contains A, N Next N line follows which shows transactions in following manner. X Y

Output A single integer , i.e. Integer value of Amount

Constraints : 1<=A<=10^8 1<=N<=10^4 1<=X<=10^8 1<=|Y|<=10^7

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
Tags:
Medium
Points:30
5 votes
Tags:
CombinatoricsMathematicsMediumOpenApproved