首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
FIVEszc
2024年3月8日 21:10
日期计算 题解:C 显示50%不通过,有无大佬帮看一下
P1051
回复 3
|
赞 0
|
浏览 1.3k
#include <stdio.h> typedef struct data { int year; int month; int day; }dat; int mon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; int main() { dat riqi; int m,d,sum=0,i=1; while (scanf("%d%d%d&q...
acv
2024年3月9日 10:16
日期计算 题解:为什么测试只通过50%
P1051
回复 1
|
赞 0
|
浏览 738
#include<iostream> using namespace std; struct date { int year; int month; int day; }; int main() { struct date d; int f[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 }; ...
光明守护神
2024年3月8日 19:02
日期计算 题解:C++
P1051
回复 0
|
赞 0
|
浏览 844
谁知道写个这种题写那么久,还是要多练!!! #include<iostream> using namespace std; const int s[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 }; struct date { int year; int month; int day; }; bool is_goodyear(int n) { if (n % 400 == 0 || (n % 4 == 0 && n % 100 != 0)) { return...
zx142407789
2024年3月8日 17:59
日期计算 题解:自用笔记
P1051
回复 0
|
赞 2
|
浏览 931
先准备存储月份的数组,其中2月份的天数根据是否年份确定,初始化为0天 判断是否错误数据:年份不能是负数,月份在合理范围内,日根据输入的月份来判断,日的判断是通过和初始化的数组逐一对比,如2月不可能出现30天 #include<stdio.h> typedef struct { int year; int month; int day; }date; int isyear(int x) {//闰年判断 if (x % 400 == 0) return 1; else if (x % 4 == 0 && x % 100...
huanghu
2024年3月7日 17:21
日期计算 题解:C++
P1051
回复 0
|
赞 2
|
浏览 1.3k
#include<stdio.h> #include<iostream> #include<string> using namespace std; struct Date{ int year; int month; int day; }; int main(){ struct Date date; int day[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; int sum=0; while(cin>&g...
A001
2024年3月4日 15:57
日期计算 题解:好心人帮我看看为什么只通过50%,感谢!!!能举出错误
P1051
回复 2
|
赞 1
|
浏览 1.4k
#include<stdio.h> struct note{ int year; int month; int day; }x; int main(){ while(scanf("%d%d%d",&x.year,&x.month,&x.day)!=EOF){ if(x.year<0||x.month<1||x.month>12){ printf(&...
orderrr
2024年2月23日 19:41
日期计算 题解:
P1051
回复 0
|
赞 1
|
浏览 933
定义一个二维数组 存储 闰年和非闰年的每个月都有多少天 . #include <bits/stdc++.h> using namespace std; struct data { int year, month, day; } p; bool Isrunnian(int year) { if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) { &...
Hegel
2023年3月20日 16:04
计算某个日期是该年的第几天
P1051
回复 0
|
赞 0
|
浏览 3.0k
#include <iostream> using namespace std; typedef struct Data { int y, m, d; }dat; bool Jud(int year) { return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); } int main() { dat p; while (cin>>p.y>>p.m>>p.d) { int flag = Jud(p.y), sum = 0...
huangdashuaige
2023年2月15日 21:25
P1051题解
P1051
回复 0
|
赞 0
|
浏览 3.0k
#include <iostream> using namespace std; typedef struct year_month_day{ //引入结构体,并定义整型变量y、m、d用于记录年月日 int y,m,d; }YMD; //使用typedef重命名,方便后续代码书写 int main(){ YMD ymd; //定义结构体变量 int sum,md[12]={31,28,31,30,31,30,3...
落翼
2023年1月26日 21:51
python求解
P1051
回复 0
|
赞 2
|
浏览 3.8k
一开始只通过50%的数据,一直找错误,发现逻辑没问题,但就是只过50%,代码如下: class Data: def __init__(self,year,month,day): self.year = year self.month = month self.day = day record = [0,31,28,31,30,31,30,31,31,30,31,30,31] def main(): while True: try: year,mont...
1
2
3
4
5
题目
日期计算
题解数量
43
发布题解
在线答疑
热门题解
1
日期计算 题解:
2
日期计算 题解:AC50%不知道什么原因 有没有大佬帮忙看看
3
日期计算 题解:AC为50%,不知道哪里有问题,求解
4
日期计算 题解:50%,不知道哪里错了
5
日期计算 题解:有人能看看为啥ac50%吗
6
日期计算 题解:按教材上敲的怎么通过只有百分之五十
7
日期计算 题解:
8
日期计算 题解:棒棒题解
9
日期计算 题解:
10
日期计算 题解: