Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "iostream"
- #include "vector"
- #include "string"
- using namespace std;//янв фев мар апр май июн июл авг сен окт ноя дек
- vector <int> MOUNTH ={31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
- int main(){
- int number_m = 0;
- vector <vector<string>> Day_Biz(MOUNTH[number_m]+1); //empty vector, lenth = days_in_mounth
- int q;
- cin >> q;
- for (int i = 0; i < q; i++){
- string operation;
- cin >> operation;
- if (operation == "ADD"){
- int day;
- string Biz;
- cin >> day >> Biz; // вводим день и задание
- Day_Biz[day].push_back(Biz);// пушбэчим задание в день
- } else if (operation == "NEXT"){
- int current_mounth = MOUNTH[number_m]+1;// число дней в текущем месяце
- int next_mounth = MOUNTH[number_m + 1]+1;// число дней в следующем месяце
- if (next_mounth < current_mounth){//если число в следующем больше чем в текущем
- int n = current_mounth - next_mounth; // берем разницу в количестве дней между месяцами
- for (n; n > 0; n-- ){
- for (auto m: Day_Biz[current_mounth - n]) { // добавляем
- Day_Biz[next_mounth-1].push_back(m);
- }
- }
- }
- Day_Biz.resize(next_mounth);
- number_m+=1;
- if (number_m > 11){
- number_m = 0;
- }
- } else if (operation == "DUMP"){
- int outDay;
- cin >> outDay;
- cout << Day_Biz[outDay].size()<<" ";
- for (auto m : Day_Biz[outDay]){
- cout << m << " ";
- }
- cout << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement