Skip to content

Commit

Permalink
Update 1904.The-Number-of-Full-Rounds-You-Have-Played.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
wisdompeak authored Jun 21, 2021
1 parent 6f1d48c commit 238f90a
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ class Solution {
{
vector<int>start = {stoi(startTime.substr(0,2)), stoi(startTime.substr(3))};
vector<int>end = {stoi(finishTime.substr(0,2)), stoi(finishTime.substr(3))};


if (start[0] * 60 + start[1] > end[0] * 60 + end[1])
end[0] += 24;

start[1] = (start[1]+14) / 15 * 15;
end[1] = end[1] / 15 * 15;

int a = start[0]*60+start[1];
int b = end[0]*60+end[1];

if (a > b)
b += 24*60;

return (b-a)/15;

int a = start[0] * 60 + start[1];
int b = end[0] * 60 + end[1];

return max(0, (b-a)/15);
}
};

0 comments on commit 238f90a

Please sign in to comment.