Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<vector>
- #include<string>
- using namespace std;
- int main() {
- vector <int> month = {31,28,31,30,31,30,31,30,31,30,30,31};
- int mi = 0;
- vector<vector<string>> tmp(month[mi]);
- int n;
- cin >> n;
- for (int i = 0; i < n; ++i) {
- string sel;
- cin >> sel;
- if (sel == "ADD") {
- string work;
- int day;
- cin >> day >> work;
- tmp[day - 1].push_back(work);
- }
- else if (sel == "DUMP") {
- int day;
- cin >> day;
- for (const auto& s : tmp[day - 1]) {
- cout << s << ' ';
- }
- }
- else if (sel == "NEXT") {
- if (mi == 11) {
- mi = 0;
- }
- else if (mi != 11) {
- ++mi;
- if (month[mi] < month[mi - 1]) {
- vector<string> temp;
- tmp.resize(month[mi]);
- int index = 0;
- for (auto s : tmp) {
- ++index;
- for (auto t : s) {
- if (index > month[mi]) {
- temp.push_back(t);
- }
- }
- }
- tmp.insert(end(tmp), begin(temp), end(temp));
- }
- else if (month[mi] > month[mi - 1]) {
- ++mi;
- tmp.resize(month[mi]);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement