PROBLEM 90
Hard

Total with Tax

Programming Basics · C++

</>
STATUS Not solved

TASK

Problem

#90

In “Total with Tax”, given price and integer tax percent, print price including tax with integer arithmetic.

EXAMPLE

Example

Input
100 4
Output
104

LIMITS

Constraints

All values are non-negative and at most 10^12; every capacity/divisor is positive.
📖
LEARN Theory for this problem
+

Translate the story into a small arithmetic formula. Use ceiling division `(a+b-1)/b` when a partially filled unit still counts.

Connection to “Total with Tax”: here, intermediate values are best kept in named variables so the formula stays readable and data types remain clear.

💡
NEED HELP? Hints
+

['Identify what each input value means before writing the formula.', 'After solving “Total with Tax”, verify the algorithm on your own small example and on an allowed boundary case. Print only the required result with no extra text.']

ANSWER Solution
+
#include <iostream>
using namespace std;
int main() {
    long long price, tax;
    cin >> price >> tax;
    cout << price * (100 + tax) / 100 << '\n';
    return 0;
}