首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
linlan
2024年1月27日 17:48
日期类 题解:
P1437
回复 0
|
赞 2
|
浏览 1.1k
1.对2月特判:闰年、非闰年 2.31天、30天的特判 3.12月的最后一天特判 4.其余时间:d++; 5.注意输出格式 %02d #include <bits/stdc++.h> using namespace std ; int is(int y) { return ((y % 4 == 0 && y % 100 != 0) || (y % 400 == 0)); } void solve() { int y, m, d; &nbs...
Cookie‘s AE86
2024年1月18日 16:25
日期类 题解:C++实现
P1437
回复 0
|
赞 2
|
浏览 1.3k
需注意 (1)日进位:一个月的最后一天加一天后日变为1月份加1,例如:1999 11 30; (2)月进位:月加1后若变为13月需要将月份变为1,年份加1,例如:1999 12 31; #include<bits/stdc++.h> using namespace std ; int main(){ int n ; cin >> n ; int year[n] ,month[n] ,day[n] ; int f [ ] = {0 ,31 ,28 ,31 ,30 ,31 ,30 ,31...
Syou
2023年8月14日 14:47
日期类 题解:
P1437
回复 0
|
赞 2
|
浏览 1.6k
C++ 逐个单独处理年末和月末的情况 #include <iostream> #include <iomanip> using namespace std; bool isLeapYear(int year){ return (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); } void show(int year, int month, int day){ if(month == 12 && day == 31){ ...
dongqing
2023年7月27日 10:04
日期类 题解:
P1437
回复 0
|
赞 1
|
浏览 1.2k
考虑特殊年份特殊day几种情况 #include<bits/stdc++.h> using namespace std; int main() { int m; int f[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; cin>>m; for(int i=0;i<m;i++) { int y,m,d; cin>>y>>m>>d; ...
老猫
2021年1月11日 21:23
话说这题不是让写一个类吗?
P1437
回复 2
|
赞 2
|
浏览 9.7k
不知道是不是我理解错了 应该是让我们用类的做法 #include<iostream> #include <string> using namespace std; class date { public: int month[13]; //对日期加1 void increase(int year,int mon,int day) { if((year%400==0)||(year%4==0)&&(year%100!=0)) month[2]=29; else month[2]=2...
Sacan
2022年6月4日 16:27
同1410
P1437
回复 0
|
赞 1
|
浏览 4.6k
#include <iostream> using namespace std; int main() { int n; cin >> n; int days[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; for(int i = 1;i <= n;i++){ int y,m,d; cin >> y >> m >> d; if((y%4==0 && y...
happyday
2022年4月6日 15:38
题目没有闰年,在此就没考虑
P1437
回复 0
|
赞 2
|
浏览 6.0k
#include <bits/stdc++.h> using namespace std; int main(){ int n; int y,m,d; int f[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; cin>>n; for(int i=0; i<n; i++){ cin>>y>>m>>d; if(d+1<=f[m]){//如果天数加1没有超过该月份总天数,只改变天数 ...
杨德胜
2021年3月6日 15:16
P1437 解题思路分享
P1437
回复 0
|
赞 3
|
浏览 8.0k
#include <bits/stdc++.h> using namespace std; int main() { int n; int y,m,d; cin>>n; while(n--){ cin>>y>>m>>d; int f[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; d=d+1; if(d>f[m]){ d=d-f[m]; m++; } printf("%d-%02d-%02d\n",y...
A1120161820
2020年3月6日 16:24
日期类(c++)
P1437
回复 2
|
赞 1
|
浏览 11.4k
#include<iostream> #include<cstdio> using namespace std; int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; bool extra(int y) { if (y%400) return true; else if (y%100 != 0 && y%4==0) return true; else return false; } void add_one(int y, i...
FinalTaco
2020年3月26日 01:29
蒟蒻作法
P1437
回复 0
|
赞 1
|
浏览 10.6k
#include<bits/stdc++.h> using namespace std; int yuetianshu[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; int main(){ int n = 0; cin >> n; &nbs...
1
2
题目
日期类
题解数量
20
发布题解
在线答疑
热门题解
1
日期类 题解:成功AC,nice
2
日期类 题解:暴力
3
日期类(模拟) 题解:
4
日期类 题解:
5
P1437 解题思路分享
6
日期类 题解:C++实现
7
日期类 题解:
8
日期类 题解:
9
题目没有闰年,在此就没考虑
10
话说这题不是让写一个类吗?