标签:src name printf mat info using mamicode namespace mic
#include <iostream> #include <cstdio> #include <cmath> using namespace std; bool is_leap_year(int y) { if((y % 4 == 0 && y % 100 != 0) || (y % 400 == 0)) return true; else return false; } int main() { int month[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; int y, m, d, sum; while(~scanf("%d/%d/%d", &y, &m, &d)) { sum = 0; month[2] = is_leap_year(y) ? 29 : 28; for(int i = 1; i < m; ++ i) { sum += month[i]; } sum = sum + d; printf("%d\n", sum); } return 0; }
标签:src name printf mat info using mamicode namespace mic
原文地址:https://www.cnblogs.com/mjn1/p/11232490.html