Easy Solution
```\nclass Solution {\npublic:\n    int minCostSetTime(int sa, int mc, int pc, int ts) {\n        int mnMin=ts/60,mnSec=ts%60;\n        int mnMin1=ts/60,mnSec1=
```\nclass Solution {\npublic:\n    int minCostSetTime(int sa, int mc, int pc, int ts) {\n        int mnMin=ts/60,mnSec=ts%60;\n        int mnMin1=ts/60,mnSec1=ts%60;\n        if(mnSec1<40 && mnMin1!=0){\n            mnSec1=mnSec+60;\n            mnMin1--;\n        }\n        string s1="",s2="";\n        s1=to_string(mnMin*100+mnSec);\n        s2=to_string(mnMin1*100+mnSec1);\n        int a1=0,a2=0,t=sa,c0=0;\n        for(auto &x:s1){\n            if(sa==x-\'0\'){\n                a1+=pc;\n            }\n            else{\n                a1+=pc+mc;\n                sa=x-\'0\';\n            }\n        }\n        sa=t;t=sa;\n        c0=0;\n        for(auto &x:s2){       \n            if(sa==(x-\'0\')){\n                a2+=pc;\n            }\n            else{\n                a2+=pc+mc;\n                sa=x-\'0\';\n            }\n        }\n        if(mnMin==100)\n            return a2;\n        return min(a1,a2);\n        \n    }\n};
['C', 'C++']