Hatena::Grouptopcoder

TopCoderの問題を解く

解いた問題の一覧表

2009-08-07

BritishCoins

| 19:21

問題文

コインの数。

242.83/250 - 00:05:05

class BritishCoins {
    public:
        vector <int> coins(int pence) {
            const static int SHILLING = 12;
            const static int POUND = 20 * SHILLING;
            vector <int> result(3);
            result[0] = pence / POUND;
            pence %= POUND;
            result[1] = pence / SHILLING;
            pence %= SHILLING;
            result[2] = pence;
            return result;
        }
};