#include using namespace std; bool isHappy(int mon,int day); int main(void){ //calc int cnt=0; bool happy; for(int mon=1;mon <= 12;mon++){ if(mon == 2){ for(int j=1;j<=28;j++){ happy = isHappy(mon,j); if(happy) cnt++; } }else if(mon == 4 || mon == 6 || mon == 9 || mon == 11){ for(int j=1;j<=30;j++){ happy = isHappy(mon,j); if(happy) cnt++; } }else{ for(int j=1;j<=31;j++){ happy = isHappy(mon,j); if(happy) cnt++; } } } //output cout << cnt; } bool isHappy(int mon,int day){ int day_sum = (day / 10) + (day % 10); if(day_sum == mon){ return true; }else{ return false; } }