当前位置:网站首页>Question B: shunzi date
Question B: shunzi date
2022-07-25 03:09:00 【Leng Chi】
【 Problem description 】 Xiao Ming likes shunzi very much . Shunzi refers to three consecutive numbers :123、456 etc. . Shunzi day A period refers to a period on a date yyyymmdd In representation , There are three consecutive digits The date of the child . for example 20220123 It's a shunzi date , Because it has a shunzi :123; and 20221023 Is not a shunzi date , It doesn't have a straight son . Xiao Ming wants to know in the whole 2022 In the middle of the year , How many shunzi dates are there altogether .
【 Answer submission 】 This is a question to fill in the blanks , You just need to work out the results and submit them . The result of this question is one It's an integer , Only fill in the whole number when submitting the answer , Fill in the extra content will not be able to score .
#include <iostream>
using namespace std;
int date1[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; // determine 2022 The number of days per month in the year
int main()
{
int b[8]; //b[0] To b[4] It means 2022 year
b[0] = 2;
b[1] = 0;
b[2] = 2;
b[3] = 2;
int sum = 0;
for (int i = 1; i <= 12; i++) // From January to 12 month
{
date1[4] = i / 10; // High number of months
date1[5] = i % 10; // Low number of months
for (int j = 1; j <= date1[i]; j++) // From the first day to the last day of each month
{
date1[6] = j / 10; // Indicates the high order of days
date1[7] = j % 10; // Indicates the low order of the number of days
if ((date1[4] + 1 == date1[5] && date1[5] + 1 == date1[6]) || (date1[5] + 1 == date1[6] && date1[6] + 1 == date1[7])) // If it is shunzi date +1
{
sum++;
}
}
}
cout << sum << endl;
return 0;
}边栏推荐
- Backtracking to solve combinatorial problems
- Learning record 10
- The file in scanpy1.9.1 cannot be read in scanpy1.7.2. The problem is solved
- Arduino IDE for raspberry PI Pico development firmware localization installation tutorial
- Openlayers draw circles and ellipses
- JS foundation -- hijacking of this keyword
- Decoding webp static pictures using libwebp
- Riotboard development board series notes (VIII) -- building desktop system
- JS construct binary tree
- [jailhouse article] scheduling policies and system software architectures for mixed criticality
猜你喜欢

The latest interview questions and analysis of software testing in 2022

Riotboard development board series notes (VII) -- the use of framebuffer

Publish the project online and don't want to open a port

Error: tomee required to support ear/ejb deployment

Wechat sports field reservation of applet completion works applet graduation design (8) graduation design thesis template

JS written test question -- promise, setTimeout, task queue comprehensive question

Common methods of array

Pypi counts the number of Downloads

Use of stm32cubemonitor part I - data plotting and instrument display

Preliminary foundation JVM
随机推荐
NVM installation and use
Ffmpeg 4.3 add custom demuxer
How to take the mold for the picture of 1.54 inch TFT st7789 LCD screen
Dc-1-practice
Recursive and non recursive methods are used to realize the first order, middle order and second order traversal of binary tree respectively
Read and upgrade st-link chip information and SWD burning media through STM32 stlink utility tool
[stm32f103rct6] can communication
Define macros in makefile and pass them to source code
Unity refers to a variable in another class (its own instance)
Bgy development small example
JS foundation -- regular expression
New key points of ES6
Innobackupex parameter description
Banana pie bpi-m5 toss record (2) -- compile u-boot
JS construction linked list
Resolve the error: org.apache.ibatis.binding.bindingexception
The difference between abstract classes and interfaces
Error: tomee required to support ear/ejb deployment
Domain driven model (DDD)
MySQL common function summary, very practical, often encountered in interviews