C语言关于“数日子”的一次实验记录
程序员文章站
2022-03-23 19:28:41
c语言关于“数日子”的一次实验记录
#include
#include
int main()
{
int y, m, d, n, i, s;
sc...
c语言关于“数日子”的一次实验记录
#include #include int main() { int y, m, d, n, i, s; scanf("%d", &n); for(i = 0;i < n;i++) { s = 0; scanf("%d %d %d", &y, &m, &d); switch(m) { case 12:s += d; case 11:if(m == 11){s += d;}else{s += 30;} case 10:if(m == 10){s += d;}else{s += 31;} case 9:if(m == 9){s += d;}else{s += 30;} case 8:if(m == 8){s += d;}else{s += 31;} case 7:if(m == 7){s += d;}else{s += 31;} case 6:if(m == 6){s += d;}else{s += 30;} case 5:if(m == 5){s += d;}else{s += 31;} case 4:if(m == 4){s += d;}else{s += 30;} case 3:if(m == 3){s += d;}else{s += 31;} case 2:if((y % 4 == 0 && y % 100 != 0) || y % 400 == 0){if(m == 2){s += d;}else{s += 29;}}else{if(m == 2){s += d;}else{s += 28;}} case 1:if(m == 1){s += d;}else{s += 31;} } printf("%d\n", s); } return 0; }
上一篇: SQL Server查看Sql语句执行的耗时和IO消耗
下一篇: 车联网的大蛋糕,谁将吃得最好?