Uva 10683 Solution

#include<bits/stdc++.h>
#define ll long long int
#define nhr 360000
#define nmn 6000
#define dhr 1000000
#define dmn 10000
using namespace std;
int ml, sc, mn, hr;
void divide(string s)
{
    hr = (s[0] - 48);
    hr = (hr * 10) + (s[1] - 48);

    mn = (s[2] - 48);
    mn = (mn * 10) + (s[3] - 48);

    sc = (s[4] - 48);
    sc = (sc * 10) + (s[5] - 48);

    ml = (s[6] - 48);
    ml = (ml * 10) + (s[7] - 48);
}

int main()
{
    string s;
    while(cin >> s)
    {
        divide(s);
        if(hr == 0 && mn == 0 && sc == 0 && ml == 0)
        {
            cout << "0000000" << "\n";
            continue;
        }

        ll time = (hr * nhr) + (mn * nmn) + (sc * 100) + ml;

        time = (time*10*dhr)/(24*nhr);

        cout << right << setw(7) << setfill('0') << time << "\n";
    }
    return 0;
}

Comments