// UVa 10683 - The decadary watch #include <string> #include <iostream> using namespace std; #define type unsigned long long type w[4] = { 360000, 6000, 100, 1 }; int main() { string l; while (getline(cin, l) && l.length() > 0) { type ccs = 0; for (int i = 0; i < 4; i++) ccs += ((l[i * 2] - '0') * 10 + l[i * 2 + 1] - '0') * w[i]; type tot = ccs * 10000000 / 8640000; int pow = 1000000; for (int i = 0; i < 7; i++) { cout << tot / pow; tot %= pow; pow /= 10; } cout << endl; } return 0; }
No comments:
Post a Comment