K (ngn/k), (削除) 25 (削除ここまで) 2120 bytes
Solution:
{+/y,28+x#413561787円x#28+43390446円}
Explanation:
Assumes months are 0-indexed!
Naive approach, there are likely better ones out there.
{+/y,28+x#413561787円x#28+43390446円} / the solution
{ } / lambda taking implicit x, y args
413561787円43390446円 / creates 3 0 3 2 3 2 3 3 2 3 2 3 from base-4
x# 28+ / take 'month'add items28 fromto thiseach listitem (January = 0vectorised)
28+x# / addtake 28'month' toitems eachfrom itemthis list (vectorisedJanuary = 0)
y, / prepend 'days'
+/ / sum up
Edits:
- -45 bytes; using deltas against 28 instead of days-per-month
Extra:
- +2 bytes for 1-indexed month
{+/y,x#0,28+43390446円}
K (ngn/k), (削除) 25 (削除ここまで) 21 bytes
Solution:
{+/y,28+x#413561787円}
Explanation:
Assumes months are 0-indexed!
Naive approach, there are likely better ones out there.
{+/y,28+x#413561787円} / the solution
{ } / lambda taking implicit x, y args
413561787円 / creates 3 0 3 2 3 2 3 3 2 3 2 3 from base-4
x# / take 'month' items from this list (January = 0)
28+ / add 28 to each item (vectorised)
y, / prepend 'days'
+/ / sum up
Edits:
- -4 bytes; using deltas against 28 instead of days-per-month
K (ngn/k), (削除) 25 (削除ここまで) 20 bytes
Solution:
{+/y,x#28+43390446円}
Explanation:
Assumes months are 0-indexed!
Naive approach, there are likely better ones out there.
{+/y,x#28+43390446円} / the solution
{ } / lambda taking implicit x, y args
43390446円 / creates 3 0 3 2 3 2 3 3 2 3 2 from base-4
28+ / add 28 to each item (vectorised)
x# / take 'month' items from this list (January = 0)
y, / prepend 'days'
+/ / sum up
Edits:
- -5 bytes; using deltas against 28 instead of days-per-month
Extra:
- +2 bytes for 1-indexed month
{+/y,x#0,28+43390446円}
K (ngn/k), 25(削除) 25 (削除ここまで) 21 bytes
Solution:
{+/y,x#30 31 28@3317449円28+x#413561787円}
Explanation:
Assumes months are 0-indexed! +2 bytes if we need 1-indexed months
Naive approach, there are likely better ones out there.
{+/y,x#30 31 28@3317449円28+x#413561787円} / the solution
{ } / lambda taking implicit x, y args
413561787円 / creates 3 0 3317449円3 2 /3 create2 13 3 2 13 02 13 0from 1base-4 1 0 1 0 1 index
30 31x# 28@ / indextake into'month' days
items from this list (January x#= 0)
28+ / take/ 'month'add items28 fromto thiseach listitem (January = 0vectorised)
y, / prepend 'days'
+/ / sum up
Edits:
- -4 bytes; using deltas against 28 instead of days-per-month
K (ngn/k), 25 bytes
Solution:
{+/y,x#30 31 28@3317449円}
Explanation:
Assumes months are 0-indexed! +2 bytes if we need 1-indexed months
Naive approach, there are likely better ones out there.
{+/y,x#30 31 28@3317449円} / the solution
{ } / lambda taking implicit x, y args
3317449円 / create 1 2 1 0 1 0 1 1 0 1 0 1 index
30 31 28@ / index into days
x# / take 'month' items from this list (January = 0)
y, / prepend 'days'
+/ / sum up
K (ngn/k), (削除) 25 (削除ここまで) 21 bytes
Solution:
{+/y,28+x#413561787円}
Explanation:
Assumes months are 0-indexed!
Naive approach, there are likely better ones out there.
{+/y,28+x#413561787円} / the solution
{ } / lambda taking implicit x, y args
413561787円 / creates 3 0 3 2 3 2 3 3 2 3 2 3 from base-4
x# / take 'month' items from this list (January = 0)
28+ / add 28 to each item (vectorised)
y, / prepend 'days'
+/ / sum up
Edits:
- -4 bytes; using deltas against 28 instead of days-per-month
K (ngn/k), 25 bytes
Solution:
{+/y,x#30 31 28@3317449円}
Explanation:
Assumes months are 0-indexed! +2 bytes if we need 1-indexed months
Naive approach, there are likely better ones out there.
{+/y,x#30 31 28@3317449円} / the solution
{ } / lambda taking implicit x, y args
3317449円 / create 1 2 1 0 1 0 1 1 0 1 0 1 index
30 31 28@ / index into days
x# / take 'month' items from this list (January = 0)
y, / prepend 'days'
+/ / sum up