题解 | #四季#
四季
https://www.nowcoder.com/practice/eaf21203b61b4a689987fdc165d00dfc
#include<stdio.h> int jud(int y, int x) { if (x >= 3 && x <= 5) return 1; else if (x >= 6 && x <= 8) return 2; else if (x >= 9 && x <= 11) return 3; else return 4; } int main() { int year = 0; int month = 0; scanf("%4d%2d", &year, &month); int g = jud(year, month); if (g == 1) printf("spring\n"); else if (g == 2) printf("summer\n"); else if (g == 3) printf("autumn\n"); else if (g == 4) printf("winter\n"); return 0; }