package main import ( "fmt" "strconv" "strings" ) func main() { day_max, happy_day := 0, 0 for month := 1; month <= 12; month++ { switch month { case 2: day_max = 28 case 4, 6, 9, 11: day_max = 30 default: day_max = 31 } for day := 1; day <= day_max; day++ { sum := 0 if day < 10 { sum += day } else { tmp := strings.Split(strconv.Itoa(day), "") switch tmp[0] { case "1": sum += 1 + day - 10 case "2": sum += 2 + day - 20 case "3": sum += 3 + day - 30 } } if month == sum { happy_day++ } } } fmt.Println(happy_day) }