fork download
  1.  
  2. #include <iostream>
  3. #include <math.h>
  4. using namespace std;
  5.  
  6. void count(int c)
  7. {
  8. int j = 31;
  9. if(c == 1)
  10. {
  11. j-= 3;
  12. while(j != 1)
  13. {
  14.  
  15. --j;
  16. cout << j << "\n";
  17. }
  18. }
  19. else if(c == 2)
  20. {
  21. j-= 1;
  22. while(j!= 1)
  23. {
  24. cout << j << "\n";
  25. j--;
  26. }
  27. }
  28. else if(c == 3)
  29. {
  30. while(j == 1)
  31. {
  32. j--;
  33. cout << j << "\n";
  34. }
  35. }
  36. }
  37. int main()
  38. {
  39. int DM[7] = {1,3,5,7,8,10,12};
  40. int mTh;
  41. cin >> mTh;
  42. for(auto a : DM)
  43. {
  44. if(DM[a] == mTh)
  45. {
  46. count(3);
  47. }
  48. }
  49. if(mTh == 2)
  50. {
  51. count(1);
  52.  
  53. }
  54. else
  55. {
  56. count(2);
  57. }
  58. }
  59.  
  60.  
  61.  
  62.  
Success #stdin #stdout 0s 5276KB
stdin
2
stdout
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1