Preview:
#include <iostream>
using namespace std;
int main()
{
    int n, r, i, t, q, w, a, s, d;
    cin>>r;
    for(i=1;i<=r;i++)
    {
        cin>>n;
        q=w=a=s=d=0;
        t=n%60;
        q+=n/60;
        if(t>35)
        {
            q++;
            if(t%10<5)
            {
                a+=6-t/10;
                s+=t%10;
            }
            else
            {
                a+=(60-t)/10;
                d+=(60-t)%10;
            }
        }
        else
        {
            if(t%10<=5)
            {
                w+=t/10;
                s+=t%10;
            }
            else
            {
                w+=t/10+1;
                d+=10-t%10;
            }
        }
        cout<<q<<" "<<w<<" "<<a<<" "<<s<<" "<<d<<"\n";
    }
    return 0;
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter