当前位置:网站首页>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;
}
边栏推荐
- Thinking on Architecture Design (under continuous updating)
- 一个复制也能玩出花来
- Solve 9 with C language × 9 Sudoku (personal test available) (thinking analysis)
- Briefly describe the implementation principle of redis cluster
- A doctor's 22 years in Huawei
- [Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 13
- "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 10
- 怎么检查GBase 8c数据库中的锁信息?
- LeetCode 103. Binary tree zigzag level order transverse - Binary Tree Series Question 5
猜你喜欢
QT release exe software and modify exe application icon
Sword finger offer 29 Print matrix clockwise
Pat grade a 1033 to fill or not to fill
Li Kou today's question -729 My schedule I
Shell脚本更新存储过程到数据库
The third level of C language punch in
3D drawing ()
Httprunnermanager installation (III) - configuring myql Database & initialization data under Linux
爬虫(9) - Scrapy框架(1) | Scrapy 异步网络爬虫框架
Initial understanding of pointer variables
随机推荐
SSM 程序集
Solution: attributeerror: 'STR' object has no attribute 'decode‘
Briefly describe the implementation principle of redis cluster
"Hands on learning in depth" Chapter 2 - preparatory knowledge_ 2.5 automatic differentiation_ Learning thinking and exercise answers
【MySQL 15】Could not increase number of max_open_files to more than 10000 (request: 65535)
Shell脚本更新存储过程到数据库
Deeply analyze the chain 2+1 mode, and subvert the traditional thinking of selling goods?
PMP每日一练 | 考试不迷路-7.5
Shell script updates stored procedure to database
爬虫(9) - Scrapy框架(1) | Scrapy 异步网络爬虫框架
C语言sizeof和strlen的区别
一个复制也能玩出花来
HDU_p1237_简单计算器_stack
HDU_ p1237_ Simple calculator_ stack
Force buckle 146 LRU cache
[Yunju entrepreneurial foundation notes] Chapter II entrepreneur test 9
主数据管理(MDM)的成熟度
DDoS attacks - are we really at war?
纯Qt版中国象棋:实现双人对战、人机对战及网络对战
[untitled] a query SQL execution process in the database