当前位置:网站首页>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;
}边栏推荐
- Download the jar package of jsqlparser and PageHelper
- Three ways to solve your performance management problems
- [stm32f103rct6] can communication
- JS foundation -- JSON
- Decoding webp static pictures using libwebp
- DOM node type
- Inheritance (prototype)
- JS foundation -- regular expression
- Swiper4 is used to smooth longitudinal seamless scrolling. After clicking or dragging the mouse, the animation is not completely completed, the mouse moves out of the automatic rotation, and the dynam
- [Kali's sshd service is enabled]
猜你喜欢

Domestic edge computing organization and product research

Arduino IDE for raspberry PI Pico development firmware localization installation tutorial

Vscode configuration, eslint+prettier combined with detailed configuration steps, standardized development

What should I do when the interface encounters jsonstring

mysql_ Record the executed SQL

Selenium framework operation steelth.min.js file hides browser fingerprint features

New key points of ES6

Arduino + si5351 square wave generator

Banana pie bpi-m5 toss record (3) -- compile BSP

Publish the project online and don't want to open a port
随机推荐
Learning record 12
Learning record Xi
Jenkins plug-in development -- plug-in expansion
ECMAScript new features
[Kali's sshd service is enabled]
Tensorflow's study notes (I)
JS common interview questions
JS construct binary tree
Vulntarget vulnerability shooting range -vulntarget-b
Color space (2) -- YUV
JS foundation -- data
Map set learning
Method of adding kernel in Jupiter notebook
Riotboard development board series notes (VIII) -- building desktop system
Backtracking to solve subset problem
Clothing ERP | ten advantages of clothing ERP for enterprises
Query the information of students whose grades are above 80
Hyperchain hyperblockchain Shi Xingguo was interviewed by 36 krypton: the amount of customer cooperation consulting is doubling
Dynamic programming -- Digital DP
Openlayers ol ext: Transform object, rotate, stretch, zoom in