当前位置:网站首页>CCF date calculation (Full Score code + skill summary) February 2, 2015
CCF date calculation (Full Score code + skill summary) February 2, 2015
2022-06-30 14:41:00 【A cute little monkey】
Skill summary
Topic of date calculation , Remember this template
int months[13] = {
0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool Is_Leap(int y)
{
if (y % 4 == 0 && y % 100 || y % 400 == 0) return 1;
else return 0;
}
int get_days(int y, int m)
{
int d = months[m];
if (m == 2) d += Is_Leap(y);
return d;
}
Title Description
Code implementation
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int months[13] = {
0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool Is_Leap(int y)
{
if (y % 4 == 0 && y % 100 || y % 400 == 0) return 1;
else return 0;
}
int get_days(int y, int m)
{
int d = months[m];
if (m == 2) d += Is_Leap(y);
return d;
}
int main()
{
int y, d;
cin >> y >> d;
for (int i = 1; i < 13; i ++)
{
for (int j = 1; j <= get_days(y, i); j ++)
{
if (-- d == 0)
{
cout << i << endl << j;
return 0;
}
}
}
return 0;
}
边栏推荐
- @Role of ResponseBody
- Component communication mode
- ctfshow nodejs
- ES6 notes
- Logiciel de récupération de données easyrecovery15 téléchargement
- After the MySQL service on the local computer is started and stopped, some services will automatically stop when they are not used by other services or programs
- Use PHP to delete the specified text content in the file
- The first three passes of sqli Labs
- Non decreasing column
- Laravel artist command error
猜你喜欢
MySQL back to table query optimization
LIS error: this configuration section cannot be used in this path
[extensive reading of papers] multimodal attribute extraction
ES6 notes
Detailed explanation of the first three passes of upload Labs
CCF window (Full Score code + problem solving idea) March 2, 2014
PS tip: the video frame to Layer command cannot be completed because dynamiclink is not available
[geek challenge 2019] PHP problem solving record
Ctfshow getting started with the web (ThinkPHP topic)
Computer screenshot how to cut the mouse in
随机推荐
Race of golang
V3 02——What‘s new in Chrome extensions
CCF command line options (Full Score code + problem solving ideas + skill summary) March 3, 2014
Advanced usage of go language for loop break and continue
Go language func function
@Component use cases
Attack and defense world web questions
Upgrade composer self update
PHP 2D array change key name
Notes on reverse learning in the first week of winter vacation
2021-07-14 mybaitsplus
@component使用案例
Knowledge learned from the water resources institute project
Location of dichotomy
【BUUCTF】 EasySql
Thoughts on the security of a PHP file name regular verification
[buuctf] [actf2020 freshman competition]exec1
Laravel8 custom log directory, rename
The first three passes of sqli Labs
K high frequency elements before sorting