import java.util.Calendar; public class No188 { public static void main(String[] args) { Calendar clnow = Calendar.getInstance(); clnow.set(2015, 0, 0); Calendar clend = Calendar.getInstance(); clend.set(2016, 0, 0); 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)+1 == sumDay) { count++; } clnow.add(Calendar.DATE, 1); } System.out.println(count); } }