Skip to content

Instantly share code, notes, and snippets.

@rep-movsd
Created May 16, 2016 20:52
Show Gist options
  • Save rep-movsd/7a78a0cacf9823d27ad4c14c1dd2dfb9 to your computer and use it in GitHub Desktop.
Save rep-movsd/7a78a0cacf9823d27ad4c14c1dd2dfb9 to your computer and use it in GitHub Desktop.
DateToDay
const int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int days_acc[13] = {0};
partial_sum(days, days+12, days_acc+1);
int date2day(int m, int d)
{
return days_acc[m] + d;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment