import java.util.Calendar; public class No188 { public static void main(String[] args) { Calendar clnow = Calendar.getInstance(); clnow.set(2015, 1, 1); Calendar clend = Calendar.getInstance(); clend.set(2016, 0, 1); int count = 0; while (clnow.compareTo(clend) < 0) { String[] arr = String.valueOf(clnow.get(Calendar.DATE)).split(""); int sumDay = 0; for (String s : arr) { sumDay += Integer.parseInt(s); } if (clnow.get(Calendar.MONTH) == sumDay) { count++; } clnow.add(Calendar.DAY_OF_MONTH, 1); } System.out.println(count); } }