Ccf-20171203 Crontab problem,

Source: Internet
Author: User

Ccf-20171203 Crontab problem,

Note the following points:

1. the start time and end time of the initial output, which does not include the end time.

2. The English representation of the month and week is case-insensitive, and it is not specified to be in the form of Sat.

3. the number on Sunday is 0.

My idea is to normalize the months, days, hours, minutes, and weeks in the following format:

Month: before normalization: 1, 2-4

After normalization: 1 2 3 4

Then use the stringstream class to traverse the normalized strings in sequence. In the process of traversing the month, we need to check whether the days match the month, and determine whether the day meets the requirements of the week.

Finally, determine whether the result is earlier than the deadline and greater than or equal to the start time.

The question and Code are as follows:

# Include <bits/stdc ++. h>/* # include <stdio. h> # include <iostream> # include <cstring> # include <stdlib. h >#include <sstream >#include <map> # include <vector> */using namespace std; class Time {public: int year, month, day, hour, minute; time (int year _, int month _, int day _, int hour _, int minute _): year (year _), month (month _), day (day _), hour (hour _), minute (minute _) {} void ShowTime () {cout <year <"," <month <", "<day <", "

  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.