TOJ 3471.Happy XiaoXiao Guo
2017-07-10 17:02
330 查看
题目链接:http://acm.tju.edu.cn/toj/showp3471.html
3471. Happy XiaoXiao Guo
Time Limit: 1.0 Seconds Memory Limit: 65536K
Total Runs: 271 Accepted Runs: 189
Xiao guo's brother have a son, his name is Xiaoxiao guo. In the morning, Xiao guo's brother and his wife went out. So Xiao guo must stay with her nephew. She decide to play a game with him. First, there
is an empty hole, they take turns to put some stones in the hole. Every time, 1, 2, 4 or 5 stones were placed in the hole. Two players play in turn, until one player makes a number of stones to be N in the hole and wins the game. Xiaoxiao guo always
dose first. Suppose that both Xiao guo and Xiaoxiao guo do their best in the game. Give you a number N, you are to write a program to determine Xiaoxiao guo will happy or not.
hole will not exceed 10000. The last test case is followed by one zero.
水题,找规律就行,Unhappy都是3的倍数。
3471. Happy XiaoXiao Guo
Time Limit: 1.0 Seconds Memory Limit: 65536K
Total Runs: 271 Accepted Runs: 189
Xiao guo's brother have a son, his name is Xiaoxiao guo. In the morning, Xiao guo's brother and his wife went out. So Xiao guo must stay with her nephew. She decide to play a game with him. First, there
is an empty hole, they take turns to put some stones in the hole. Every time, 1, 2, 4 or 5 stones were placed in the hole. Two players play in turn, until one player makes a number of stones to be N in the hole and wins the game. Xiaoxiao guo always
dose first. Suppose that both Xiao guo and Xiaoxiao guo do their best in the game. Give you a number N, you are to write a program to determine Xiaoxiao guo will happy or not.
Input
The input contains several test cases. The first line of each test case contains an integer number N, denoting the number of stones in the hole finally. You may assume the number of stones in thehole will not exceed 10000. The last test case is followed by one zero.
Output
For each test case, if Xiaoxiao guo win the game,output "Happy", otherwise output "Unhappy".Sample Input
3 4 7 120 0
Sample Output
Unhappy Happy Happy Unhappy
水题,找规律就行,Unhappy都是3的倍数。
#include <stdio.h> int main(){ int n; while(~scanf("%d",&n) && n) (n % 3) ? printf("Happy\n") : printf("Unhappy\n"); return 0; }
相关文章推荐
- TOJ 4284 Happy watering / 贪心
- 整数的因子和 ---TOJ 1089 Happy 2004
- 最小生成树 TOJ 4117 Happy tree friends
- 最小生成树 TOJ 4117 Happy tree friends
- Happy Birthday to 亮
- 周末HAPPY
- Happy bachelor day!
- Happy Valentine's Day!
- TOJ_1003题解
- People Ready 就是 People Happy 吗
- Happy new year!
- 生活有了目标,终于也能看进去书了,happy啊~
- 国庆黄金周...HAPPY
- happy new year!
- HappyNewYear!第一个XSP程序
- TOJ 3031. Containers
- Happy New Year!PR升3啦!
- Happy pi day! 祝所有网友节日快乐
- toj 2806 Replace Words
- toj 2483 Nasty Hacks