Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. #include "iostream"
  2. #include "vector"
  3. #include "string"
  4. using namespace std;//янв фев мар апр май июн июл авг сен окт ноя дек
  5. vector <int> MOUNTH ={31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  6. int main(){
  7. int number_m = 0;
  8. vector <vector<string>> Day_Biz(MOUNTH[number_m]+1); //empty vector, lenth = days_in_mounth
  9. int q;
  10. cin >> q;
  11. for (int i = 0; i < q; i++){
  12. string operation;
  13. cin >> operation;
  14. if (operation == "ADD"){
  15. int day;
  16. string Biz;
  17. cin >> day >> Biz; // вводим день и задание
  18. Day_Biz[day].push_back(Biz);// пушбэчим задание в день
  19. } else if (operation == "NEXT"){
  20. int current_mounth = MOUNTH[number_m]+1;// число дней в текущем месяце
  21. int next_mounth = MOUNTH[number_m + 1]+1;// число дней в следующем месяце
  22. if (next_mounth < current_mounth){//если число в следующем больше чем в текущем
  23. int n = current_mounth - next_mounth; // берем разницу в количестве дней между месяцами
  24. for (n; n > 0; n-- ){
  25. for (auto m: Day_Biz[current_mounth - n]) { // добавляем
  26. Day_Biz[next_mounth-1].push_back(m);
  27. }
  28. }
  29. }
  30. Day_Biz.resize(next_mounth);
  31. number_m+=1;
  32. if (number_m > 11){
  33. number_m = 0;
  34. }
  35. } else if (operation == "DUMP"){
  36. int outDay;
  37. cin >> outDay;
  38. cout << Day_Biz[outDay].size()<<" ";
  39. for (auto m : Day_Biz[outDay]){
  40. cout << m << " ";
  41. }
  42. cout << endl;
  43. }
  44. }
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement