Last active
August 29, 2015 14:08
-
-
Save lacolaco/f20aba0648980dae67e7 to your computer and use it in GitHub Desktop.
プロ生ちゃん #カレンダープログラミング プチコンテスト 2014
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
var today = new DateTime.now(); | |
var calendar = new List.generate(6, (i) => new List.filled(7, " ")); | |
for (var i = 1, week = 0; i <= new DateTime(today.year, today.month + 1, 0).day; i++) { | |
var day = new DateTime(today.year, today.month, i); | |
calendar[week][day.weekday % 7] += i.toString(); | |
if (day.weekday == DateTime.SATURDAY) week++; | |
} | |
print(calendar.where((w) => w.any((d) => d.trim() != "")).map( | |
(w) => w.map((d) => d.substring(d.length - 2)).join(" ")).join("\r\n")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment