首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
Hegel
2023年3月22日 20:55
求某年的第几天是该年的几月几日
P1410
回复 0
|
赞 0
|
浏览 3.1k
#include <iostream> using namespace std; bool Jud(int year) { return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); } const int Pm[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 }; const int Rm[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 }; int main() { int y, n; ...
零壹
2023年3月21日 10:13
打印日期
P1410
回复 0
|
赞 2
|
浏览 3.8k
一些值得注意的点:%02d格式输出时不足两位的座便1补0,这样就可以减少后面对于t是否小于10的判断. 思路:先将前i个月的总天数存到mon[]数组中,进行比较,然后判断输入的天数属于哪个月份,闰年要单独处理,而且要在循环内处理。 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> int main() { int y, n; while (scanf("%d%d", &y, &n) != EOF) { int mon[13] = { 0,31,28,31,30...
落翼
2023年1月29日 09:47
python求解
P1410
回复 0
|
赞 0
|
浏览 4.6k
根据天数可以求到月份数,也就是月份从1月开始加,知道大于等于天数就可以,此时就找到了,然后算出是这个月的第几天就行: record = [0,31,28,31,30,31,30,31,31,30,31,30,31] def main(): while True: try: year,day = map(int,(input().split(" "))) record[2] = 28 if year%400==0 or (year%4==0 and year%100!=...
Mihara
2022年6月7日 19:56
求一年内第几天的逆过程
P1410
回复 0
|
赞 1
|
浏览 6.1k
// C++ #include <cstdio> int main() { int y, n; int f[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; while (scanf("%d%d", &y, &n) != EOF) { // 1.判断是否为闰年 ...
Sacan
2022年6月4日 16:19
直接暴力
P1410
回复 0
|
赞 1
|
浏览 4.9k
从该年(注意闰年)的1月1日开始一天一天数过去。 #include <iostream> using namespace std; int main() { int y,n; int days[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; while(cin >> y >> n){ if((y%4==0 && y%100!=0) || y%400==0){ days[2] = 29...
杨德胜
2021年3月6日 15:02
P1410 解题思路分享
P1410
回复 0
|
赞 0
|
浏览 7.2k
#include <bits/stdc++.h> using namespace std; int jude(int y){ if ((y % 4 == 0 && y % 100 != 0) || y % 400 == 0) return 1; else return 0; } int main() { int f[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; int y,n; while(cin >>y>>n){ if(jude(y))...
鱼翔浅底
2021年1月17日 15:18
签到题
P1410
回复 0
|
赞 0
|
浏览 9.3k
#include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct { int year, month, day; } Date; int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int main() { int y,n; Date d; while (scanf("%d%d", &y, &n) ...
老猫
2021年1月11日 20:30
一个思路
P1410
回复 0
|
赞 0
|
浏览 9.0k
#include<iostream> #include <string> using namespace std; int main() { int m,n; int month[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,30,31} }; while(scanf("%d %d",&m,&n)!=EOF) { int mon=1; int day=1; while...
FinalTaco
2020年3月26日 01:12
蒟蒻作法
P1410
回复 0
|
赞 2
|
浏览 9.1k
#include<bits/stdc++.h> using namespace std; int IsLeapYear(int year){ //判断是否为闰年,因为闰年天数和平年天数不同,需要区分 if (year % 4 == 0 && year % 100 != 0) return 1; if (year % 400 == 0) return 1; return 0; } int yuetianshu[2][13] ...
tyu007
2020年3月13日 21:56
1410由年份天数,得出月份具体日期
P1410
回复 0
|
赞 2
|
浏览 10.0k
思路。就是先对年份进行处理判断闰年与否。 然后得出此年份的具体每月天数的数组。。。 之后用n去减去每个月的天数。并用 i 当作累加计数器。得出 月份 i,以及最后跳出循环的 n 即作为天数。 #include<iostream> #include<cstdio> using namespace std; int main() { int m,n; while(cin>>m>>n) { int ye[12]={...
1
2
3
4
题目
打印日期
题解数量
40
发布题解
在线答疑
热门题解
1
打印日期 题解:只有60% ,求大佬提点
2
打印日期 题解:
3
打印日期 题解:
4
打印日期 题解:
5
打印日期 题解:C语言题解 多组输入
6
打印日期 题解:求大佬解释下为什么只有60%通过率
7
打印日期 题解:暴力题解
8
打印日期(用前缀和写了一下 附注释) 题解:
9
打印日期 题解:C++实现
10
打印日期 题解:暴力