首页 > 试题广场 >

今年的第几天?

[编程题]今年的第几天?
  • 热度指数:39485 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 64M,其他语言128M
  • 算法知识视频讲解
输入年、月、日,计算该天是本年的第几天。

输入描述:
包括三个整数年(1<=Y<=3000)、月(1<=M<=12)、日(1<=D<=31)。


输出描述:
输入可能有多组测试数据,对于每一组测试数据,
输出一个整数,代表Input中的年、月、日对应本年的第几天。
示例1

输入

1990 9 20
2000 5 1

输出

263
122
头像 ading520
发表于 2022-03-05 10:39:55
">#include<cstdio> using namespace std; int dayTable[2][13]= { {0,31,28,31,30,31,30,31,31,30,31,30,31}, //平年每月天数 {0,31,29,31,30,31,30,31, 展开全文
头像 渺小小螃蟹
发表于 2021-05-07 17:37:47
include<stdio.h> include<stdbool.h> int daytab[2][13] ={ {0,31,28,31,30,31,30,31,31,30,31,30,31}, {0,31,29,31,30,31,30,31,31,30,31,3 展开全文
头像 aaaawei
发表于 2021-01-06 15:12:39
注意判断闰年就好了 预处理能用空间换时间。#include<iostream>#include<cstdio>using namespace std;</cstdio></iostream> int model[2][13]={{0,31,28,31 展开全文
头像 MrMello
发表于 2023-03-23 20:07:35
#include <stdio.h> int main(){ int Month[13] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int year, month, day; while (scanf( 展开全文
头像 爱吃鱼的懒羊羊等一个offer
发表于 2025-03-19 17:43:06
#include <iostream> using namespace std; int main() { int y, m, d; int day[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 展开全文
头像 乌龟狗的齐天大圣
发表于 2023-02-15 18:59:45
#include <stdio.h> int main(){ int year,month,day; int list1[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; int list2[13]={0,31,29,31 展开全文
头像 易水寒learning
发表于 2022-01-15 17:09:27
#include <iostream> #include <cstdio> using namespace std; int dayTab[2][13]={ {0,31,28,31,30,31,30,31,31,30,31,30,31}, {0,31, 展开全文
头像 牛客986572608号
发表于 2025-03-26 16:52:19
import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { static int aaa(int x){ if((x % 4==0 && x % 1 展开全文
头像 chong_0428
发表于 2024-03-06 12:56:05
def Day(y, m, d): day = 0 if y % 400 == 0 or (y % 4 == 0 and y % 100 !=0): f = 1 else: f=0 for i in range(1, 13): 展开全文
头像 philos
发表于 2021-02-04 20:59:43
思路 这道题无非就是区分不同月份天数不一样,以及闰年、平年的区别而已。 #include<iostream> using namespace std; int main(){ int year, month, day; int days[2][13]={{0,31,2 展开全文