题目分析:2001年1月1号星期1,然后就没什么好说的了= =
代码如下:
#include <map>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std ;
typedef long long LL ;
#define rep( i , a , b ) for ( int i = ( a ) ; i < ( b ) ; ++ i )
#define For( i , a , b ) for ( int i = ( a ) ; i <= ( b ) ; ++ i )
#define rev( i , a , b ) for ( int i = ( a ) ; i >= ( b ) ; -- i )
#define clr( a , x ) memset ( a , x , sizeof a )
#define mid ( ( l + r ) >> 1 )
const int MAXN = 15005 ;
int mon[13] = { 0 , 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31 } ;
int sum[13] = { 0 } ;
int n , m ;
void solve () {
if ( m < 1 || m > 12 || n > mon[m] || n < 1 ) printf ( "Impossible\n" ) ;
else printf ( "%d\n" , ( sum[m - 1] + n - 1 ) % 7 + 1 ) ;
}
int main () {
For ( i , 1 , 12 ) sum[i] = sum[i - 1] + mon[i] ;
while ( ~scanf ( "%d%d" , &n , &m ) ) solve () ;
return 0 ;
}