Untitled

 avatar
unknown
plain_text
a month ago
620 B
1
Indexable
#include <iostream>#include <cmath>#include <unordered_set>double round_up(const double num) {    return std::ceil(num * 100.0) / 100.0;}int main() {    double debt = 100.0;    double interest;    double repayments;    std::cin >> interest >> repayments;    interest = interest / 100;    repayments = repayments / 100;    double total_payed = 0.0;    while (debt > 0.00) {        debt += round_up(interest * debt);        const auto repayment = std::min(debt, std::max(50.0, round_up(repayments * debt)));        total_payed += repayment;        debt -= repayment;    }    std::cout << total_payed << '\n';    return 0;}
Leave a Comment