Gadha_Kishan's blog

By Gadha_Kishan, history, 5 months ago, In English

although i am newbie ..... I am learning in every corner .... I am just helping others who are stuck in this problem for such time..

I am talking about ----Codeforces Round 811 (Div. 3) 1 no question-----

A. Everyone Loves to Sleep

weird and easy right I have not slept for 10 hours it was not easy for me for the first time when i saw that....somehow i found the logic within 20 minutes but somehow i didn't implemented it for any reason maybe for less practice ...But i knew how and what will be the answer ..then i tried tried.....for 7 hours fixing ....then i found out that i was looking for how many hours and minutes he had been sleeping but trust although my approach was right but there are some issues in edges cases ...then i saw some yt videos it didn't help that much ......

finally i saw @tourist god i clicked on his submit and saw his code it was damn short and math related....

then it took 3 hours more to just expolre his thought,tescases and logic .... finally i got that ...

//////////////////////////////////////// main things over here--------- \\\\\\\\\\\\\\\\\\\\

you guys will understand if you dive into it...

int diff = y — x;--------------------------------if you talking about sleep in same day and wakeup at also same day then just simply find out the minimum------

if (diff < 0) {-----but if you talking about sleep at 23.45  alarm at then this happend------
    diff += 1440;
  }
  ans = min(ans, diff);

Full text and comments »

  • Vote: I like it
  • -5
  • Vote: I do not like it