GAME3112 - Ngày 31 tháng 12
Tác giả: hieult
Ngôn ngữ: C++
#include<cstdio>
#include<cmath>
#include<math.h>
#include<cstring>
#include<cstdlib>
#include<cassert>
#include<ctime>
#include<algorithm>
#include<iterator>
#include<iostream>
#include<cctype>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<list>
#define ep 0.00001
#define maxn 1011
#define oo 2000000001
#define modunlo 111539786
#define TR(c, it) for(typeof((c).begin()) it=(c).begin(); it!=(c).end(); it++)
#define fi first
#define se second
//#define g 9.81
double const PI=4*atan(1.0);
using namespace std;
typedef pair<int, int> II;
typedef vector<int> VI;
typedef vector<II> VII;
typedef vector<VI> VVI;
typedef vector<VII> VVII;
int f[33][13],ngay,thang;
pair<int,int> P[33][13];
int main(){
// freopen("input.in","r",stdin);
// freopen("output.out","w",stdout);
int num[] = {0,31,29,31,30,31,30,31,31,30,31,30,31};
f[31][12] = 1;
for(int j = 12; j >= 1; j--){
for(int i = num[j]; i >= 1; i--){
if(j == 12 && i == 31) continue;
f[i][j] = 0;
for(int k = i + 1; k <= num[j]; k++) if(f[k][j] == 0){
f[i][j] = 1;
P[i][j] = make_pair(k,j);
break;
}
for(int k = j + 1; k <= 12; k++) if(i <= num[k] && f[i][k] == 0){
f[i][j] = 1;
P[i][j] = make_pair(i,k);
break;
}
}
}
scanf("%d %d",&ngay,&thang);
if(f[ngay][thang]) printf("%d %d",P[ngay][thang].fi, P[ngay][thang].se);
else printf("LOSS");
}