Friday, August 15, 2014

TCHS SRM 49 - Level one - 250 pt Deposit Profit solution

TCHS SRM 49 - Level one - 250 pt Deposit Profit: http://community.topcoder.com/stat?c=problem_statement&pm=8313&rd=10809

TCHS SRM 49 - Level one - 250 pt Deposit Profit editorial: http://community.topcoder.com/tc?module=Static&d1=hs&d2=match_editorials&d3=hs_srm49

TCHS SRM 49 - Level one - 250 pt Deposit Profit solution:


#include <iostream>

class DepositProfit{
    public: int depositTerm(int a, int b, int p) {
        int cnt, st=a*100, m=0;
        a*=100, p*=100;
        while(cnt<p) a+=a*b/1200, cnt=a-st, m++;
        return m;
    }
};

No comments:

Post a Comment