当前位置:网站首页>CSP date calculation
CSP date calculation
2022-07-06 02:39:00 【< WRM>】
#include<bits/stdc++.h>
using namespace std;
bool yJudge(int y) {
if (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) {
return true;
}
return false;
}
int m1[12] = {
31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; // Leap year
int m2[12] = {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
int y, d;
scanf("%d%d", &y, &d);
int flag = 0;
int t = d;
int mongth, date;
if (yJudge(y)) {
for (int i = 0; i < 12&&t>0; i++) {
t = t - m1[i];
mongth = i + 1;
date = t + m1[i];
}
} else {
for (int i = 0; i < 12&&t>0; i++) {
t = t - m2[i];
mongth = i + 1;
date = t + m2[i];
}
}
printf("%d\n%d",mongth,date);
return 0;
}
边栏推荐
- ReferenceError: primordials is not defined错误解决
- RobotFramework入门(三)WebUI自动化之百度搜索
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 19
- 一个复制也能玩出花来
- 会员积分营销系统操作的时候怎样提升消费者的积极性?
- Keyword static
- GifCam v7.0 极简GIF动画录制工具中文单文件版
- How to improve the enthusiasm of consumers when the member points marketing system is operated?
- 主数据管理理论与实践
- Pat grade a 1033 to fill or not to fill
猜你喜欢
PMP practice once a day | don't get lost in the exam -7.5
LeetCode 103. Binary tree zigzag level order transverse - Binary Tree Series Question 5
"Hands on learning in depth" Chapter 2 - preparatory knowledge_ 2.5 automatic differentiation_ Learning thinking and exercise answers
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 13
RobotFramework入门(一)简要介绍及使用
Keyword static
Zero basic self-study STM32 wildfire review of GPIO use absolute address to operate GPIO
【无标题】数据库中一条查询SQL执行的过程
一位博士在华为的22年
深度解析链动2+1模式,颠覆传统卖货思维?
随机推荐
Black high-end responsive website dream weaving template (adaptive mobile terminal)
Redis delete policy
【无标题】数据库中一条查询SQL执行的过程
RobotFramework入门(一)简要介绍及使用
MySQL winter vacation self-study 2022 11 (8)
What should we pay attention to when using the built-in tool to check the health status in gbase 8C database?
剑指 Offer 30. 包含min函数的栈
RobotFramework入门(二)appUI自动化之app启动
Déduisez la question d'aujourd'hui - 729. Mon emploi du temps I
数据准备工作
Patch NTP server at the beginning of DDoS counterattack
"Hands on learning in depth" Chapter 2 - preparatory knowledge_ 2.5 automatic differentiation_ Learning thinking and exercise answers
Dachang image library
零基础自学STM32-野火——GPIO复习篇——使用绝对地址操作GPIO
2022 China eye Expo, Shandong vision prevention and control exhibition, myopia, China myopia correction Exhibition
Reset nodejs of the system
[postgraduate entrance examination English] prepare for 2023, learn list5 words
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 18
MySQL winter vacation self-study 2022 11 (5)
微软语音合成助手 v1.3 文本转语音工具,真实语音AI生成器