-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path115.cpp
74 lines (73 loc) · 1.56 KB
/
115.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#define printIm cout << "Impossible" << endl;
using namespace std;
bool ka(int i,int j,int w){
if (w>i || w<=j) return true;
return false;
}
int sa(int x){
if (x==0) return 7;
else return x;
}
int n,m,k;
int main(){
cin >> n >> m;
switch(m){
case 1:
if (ka(31,0,n)) {printIm;return 0;}
cout << sa(n%7) << endl;return 0;
break;
case 2:
if (ka(28,0,n)) {printIm;return 0;}
cout << sa((n%7+3)%7) << endl;return 0;
break;
case 3:
if (ka(31,0,n)) {printIm;return 0;}
cout << sa((n%7+3)%7) << endl;return 0;
break;
case 4:
if (ka(30,0,n)) {printIm;return 0;}
cout << sa((n%7+6)%7) << endl;return 0;
break;
case 5:
if (ka(31,0,n)) {printIm;return 0;}
cout << sa((n%7+1)%7) << endl;return 0;
break;
case 6:
if (ka(30,0,n)) {printIm;return 0;}
cout << sa((n%7+4)%7) << endl;return 0;
break;
case 7:
if (ka(31,0,n)) {printIm;return 0;}
cout << sa((n%7+6)%7) << endl;return 0;
break;
case 8:
if (ka(31,0,n)) {printIm;return 0;}
cout << sa((n%7+2)%7) << endl;return 0;
break;
case 9:
if (ka(30,0,n)) {printIm;return 0;}
cout << sa((n%7+5)%7) << endl;return 0;
break;
case 10:
if (ka(31,0,n)) {printIm;return 0;}
cout << sa(n%7) << endl;return 0;
break;
case 11:
if (ka(30,0,n)) {printIm;return 0;}
cout << sa((n%7+3)%7) << endl;return 0;
break;
case 12:
if (ka(31,0,n)) {printIm;return 0;}
cout << sa((n%7+5)%7) << endl;return 0;
break;
default:
printIm;return 0;
break;
}
}