首页 > 试题广场 >

计算天数

[编程题]计算天数
  • 热度指数:5591 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32M,其他语言64M
  • 算法知识视频讲解

输入年月日,计算该填是本年的第几天。例如1990 20 日是1990 年的第263 天,2000 年5 月1 日是2000 年第122 天。


输入描述:
输入第一行为样例数m,接下来m行每行3个整数分别表示年月日。


输出描述:
输出m行分别表示题目所求。
示例1

输入

2
1990 9 20
2000 5 1

输出

263
122

备注:
提示:闰年:能被400 正除,或能被4 整除但不能被100整除。每年1、3、5、7、8、10 、12为大月
头像 用户抉择
发表于 2021-03-30 21:13:26
#include <stdio.h> int main(){     int n,y,m,d,ans,i;     while(scanf("%d",&n)!=EOF){ 展开全文
头像 KDDA十三尧十三
发表于 2022-02-11 14:15:58
#include<iostream> using namespace std; //四年一润,百年不润,四百年再润,例如思考2000年,2100年,2400年与2500年,就理解了能被4整除但不能被100整数了 int m_1[12] =  展开全文
头像 在考古的小鱼干很有气魄
发表于 2023-03-13 11:39:33
#include <bits/stdc++.h> #define MAX 20 using namespace std; int a1[13] = {0,31,28,31,30,31,30,31,31,30,31,30}; int a2[13] = {0,31,29,31,30,31, 展开全文
头像 Perceive109
发表于 2023-03-28 16:16:51
#include <iostream> using namespace std; int main(){ int daytab[2][13]={ {0,31,28,31,30,31,30,31,31,30,31,30,31}, {0,31,29, 展开全文
头像 rainman_
发表于 2023-03-22 08:57:59
#include <iostream> #include <string> #include <vector> #include <algorithm> #include <stack> #include <map> #incl 展开全文
头像 尤姆
发表于 2023-03-14 08:02:26
#include<cstdio> bool fun(int n){ return n % 400 == 0 || n % 100 != 0 && n % 4 == 0; } int main(){ int n; int mday[13] = { 0, 31, 28, 31, 30, 展开全文
头像 bigbigcake
发表于 2024-03-12 15:14:00
#include <iostream> using namespace std; bool isRunNian(int year){ if(year%400 == 0)return 1; if(year%4 == 0 && year%100 !=0)re 展开全文

问题信息

上传者:小小
难度:
44条回答 4268浏览

热门推荐

通过挑战的用户

查看代码