Wednesday, June 25, 2014

TopCoder High School SRM 12 Level one - 250 pt - Indict Dates solution

TopCoder High School SRM 12 Level one - 250 pt - Indict Dates statement: http://community.topcoder.com/stat?c=problem_statement&pm=6515&rd=10064

TopCoder High School SRM 12 Level one - 250 pt - Indict Dates editorial: http://community.topcoder.com/tc?module=Static&d1=hs&d2=match_editorials&d3=hs_srm12

TopCoder High School SRM 12 Level one - 250 pt - Indict Dates solution: 

#include <iostream>
using namespace std;

class IndictDates {
    public: int getYear(int a, int b, int c) {
        int d=1, e=1, f=1, cnt=1;
        while(a!=d || b!=e || c!=f) {
            d++;
            d%=16;
            if(d==0) d++;
            e++;
            e%=29;
            if(e==0) e++;
            f++;
            f%=20;
            if(f==0) f++;
            cnt++;
        }
        return cnt;
    }
};

No comments:

Post a Comment