我的个人网站 Cheese的个人主页http://www.cheese.ren/
文章来源 ZOJ 1229 Gift?!-Cheese的个人博客ZOJ 1229 Gift?!http://blog.cheese.ren/15
欢迎交换友链 :-)
#include <iostream>
#include <stack>
#include <fstream>
using namespace std;
int n, m;
stack<int> S;
bool is_arraival(void) {
int i=1, sum=1;
S.push(i);
S.push(sum);
while (!S.empty()) {
sum = S.top();
S.pop();
i = S.top();
S.pop();
if (sum == m)
return true;
if (sum >= 1 && sum <= n) {
S.push(i+1);
S.push(sum+i*2+1);
S.push(i+1);
S.push(sum-i*2-1);
}
}
return false;
}
int main() {
while (cin >> n >> m && (n || m)) {
if (n>=49 || is_arraival())
cout << "Let me try!" << endl;
else
cout << "Don't make fun of me!" << endl;
}
return 0;
}