# 11312: 【原1312】划方格

### 题目描述

author: Juda 原OJ链接：https://acm.sjtu.edu.cn/OnlineJudge-old/problem/1312

## Sample Input

``````2
3 1
3 2
``````

## Sample Output

``````5555
Yeah!
``````

## Hint

20%数据保证k<=2 n<=1000

100%数据保证1<=n<=10^6 1<=k<=10 1<=T<=10

## q4x3's solution

``````/**
* 数学题
* 赌王划什么，Juda划对称的
**/
#include <iostream>

using namespace std;

int T, n, k;

int main() {
cin >> T;
for(int i = 0;i < T;++ i) {
cin >> n >> k;
if(k == 1) {
if(n % 2 == 0) cout << "Yeah!" << endl;
else cout << "5555" << endl;
} else {
if(n <= k) cout << "5555" << endl;
else cout << "Yeah!" << endl;
}
}
}
``````

## victrid's solution

``````#include <iostream>
using namespace std;
int main() {
// a math problem?
int m, n, k;
cin >> m;
bool* ans = new bool[m];
for (int i = 0; i < m; i++) {
cin >> n >> k;
//赌王把一个环剪开成了绳子。
//Juda把绳子剪成长度相等的两条绳子。
//赌王怎么剪Juda就怎么剪。就获胜了。

//一次一个的划，能不能剪出来要看奇偶。
if (k == 1) {
ans[i] = n % 2;
continue;
}
//一把就直接把所有数都划掉
ans[i] = k >= n;
}
for (int i = 0; i < m; i++) {
if (i)
cout << endl;
cout << (ans[i] ? "5555" : "Yeah!");
}
return 0;
}
``````

## zqy2018's solution

``````/*
See the solution at https://github.com/zqy1018/sjtu_oj_solutions/blob/master/solutions/sjtu1312.md
*/
#include <bits/stdc++.h>
#define INF 2000000000
using namespace std;
typedef long long ll;
int f = 1, x = 0;
char c = getchar();
while(c < '0' || c > '9'){if(c == '-') f = -f; c = getchar();}
while(c >= '0' && c <= '9')x = x * 10 + c - '0', c = getchar();
return f * x;
}
int n, k, f[10005];
bool vis[10005];
void init(){
}
void solve(){
if (n <= k){
printf("5555\n");
return ;
}
if (k == 1){
printf("%s\n", (n % 2 == 0 ? "Yeah!": "5555"));
}else printf("Yeah!\n");
/*
f[0] = 0;
for (int i = 1; i <= n; ++i){
memset(vis, 0, sizeof(vis));
for (int j = 1; j <= k; ++j){
for (int t = 0; t <= i - j; ++t)
vis[f[t] ^ f[i - t - j]] = true;
}
for (int t = 0; t <= n; ++t)
if (!vis[t]){
f[i] = t;
break;
}
}
for (int i = 1; i <= n; ++i)
cout << f[i] << endl;
int ans = INT_MAX;
for (int i = n - k; i < n; ++i)
ans = min(ans, f[i]);
printf("%s\n", (ans > 0 ? "Yeah!": "5555")); */
}
int main(){