AlgorithmOJ
Problem
Local Problems
All Problems
Problem Category
Status
Contest
Standard Contests
Replay Contests
Virtual Contests
Ranklist
More...
News
About
F.A.Q
Recent Contests
Coming Soon...
Login
Register
2026-04-26 09:55:11
棋盘游戏
Time Limit:
1000ms
Memory Limit:
32768KB
64-bit integer IO format:
%lld
Java class name:
Main
Prev
Submit
Status
Statistics
Next
Font Size:
Description
小明和小红在玩一种棋盘游戏,棋盘的尺寸为n个方格*m个方格。一开始在棋盘的右上角(1,m)放一枚硬币,每次一个人可以将硬币向左、下或左下的方格移动。
当某个人无法再移动硬币了,那么这个人就输了。游戏总是小明先开始,如果他们两个每步都是最优策略,则谁将赢得游戏?
Input
输入包含多组测试数据。每组输入两个整数n和m(0<n,m<=2000)。
当n=m=0时,输入结束。
Output
对于每组输入,如果小明赢,输出“Wonderful!”,否则输出“What a pity!”。
Sample Input
5 3 5 4 6 6 0 0
Sample Output
What a pity! Wonderful! Wonderful!
Author
Admin
Language:
C++ (GCC 5.4.0)
C++11 (GCC 5.4.0)
C++14 (GCC 6.3.0)
C (GCC 5.4.0)
Java (OpenJDK 1.8.0)
Pascal (FPC 3.0.0)
Python2 (2.7.12)
Python3 (3.5.2)
Python3 (3.8.2)
C# (Mono 4.2.1)
Fortran
Perl
Ruby
Ada
SML
Visual C++
Visual C
CLang
CLang++
Theme:
Monokai
Solarized Light
Material
Share Code?
Yes
No
×
Login
Username:
Password:
Cookie:
Never
One Day
One Week
One Month
One Year
×
Register
Username:
Password:
Repeat Password:
Nickname:
School:
Email:
×
News Title
by