2 shunfurh shunfurh 于 2017.09.08 20:13 提问

Anniversary

Nahid Khaleh decides to invite the kids of the "Shahr-e Ghashang" to her wedding anniversary. She wants to prepare a square-shaped chocolate cake with known size. She asks each invited person to determine the size of the piece of cake that he/she wants (which should also be square-shaped). She knows that Mr. Kavoosi would not bear any wasting of the cake. She wants to know whether she can make a square cake with that size that serves everybody exactly with the requested size, and without any waste.

Input

The first line of the input file contains a single integer t (1 <= t <= 10), the number of test cases, followed by input data for each test case. Each test case consist of a single line containing an integer s, the side of the cake, followed by an integer n (1 <= n <= 16), the number of cake pieces, followed by n integers (in the range 1...10) specifying the side of each piece.

Output

There should be one output line per test case containing one of the words KHOOOOB! or HUTUTU! depending on whether the cake can be cut into pieces of specified size without any waste or not.

Sample Input

2
4 8 1 1 1 1 1 3 1 1
5 6 3 3 2 1 1 1

Sample Output

KHOOOOB!
HUTUTU!

1个回答

caozhy
caozhy   Ds   Rxr 2017.09.24 08:32
已采纳
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐
Windows 10年度更新Anniversary Update预览版开始推送,版本号Build 14328
2015年7月29日发布的Windows 10正式版版本号是Build 10240。微软现在开始推送Windows 10年度更新Anniversary Update,PC和Mobile预览版Build 14328。正式版计划在今年夏天面向全世界用户免费推出。此年度更新版本包括了非常多的新功能:新的开始菜单平板模式改进锁屏CortanaWindows Ink通知中心等其它大量改进。下面是新功能详细介
HDU1520:Anniversary party(树形DP)
Problem Description There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the superviso
POJ1020-Anniversary Cake
转载请注明出处:優YoU         大致题意: 有一块边长为BoxSize的正方形的大蛋糕,现在给出n块不同尺寸的正方形的小蛋糕的边长,问是否能把大蛋糕按恰好切割为这n块小蛋糕,要求每块小蛋糕必须为整块。   解题思路: 有技巧的DFS   可以把大蛋糕
HDU 1520 Anniversary party(简单树形dp)
本文出自   http://blog.csdn.net/shuangde800 题目点击打开链接 题意: 给出一棵树 每个节点有权值 要求父节点和子节点不能同时取 求能够取得的最大值 思路: 树形dp的入门题 f[u][0]表示以u为顶点的子树,不选u点的情况下最大值 f[u][1]表示以u为顶点的子树,选u点的情况下最大值 那么, f[u][
[ACM] POJ 2342 Anniversary party (树形DP入门题)
Anniversary party Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 4410   Accepted: 2496 Description There is going to be a party to celebrate the 80-th Ann
poj2342 Anniversary party(树形dp)
Anniversary party Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5516 Accepted: 3164 Description There is going to be a party to celebrate the 80-th Anniv
photoshop之无法启动adobe update
http://zhidao.baidu.com/question/348706336.html
poj1020--Anniversary Cake题解
<br />原题:http://acm.pku.edu.cn/JudgeOnline/problem?id=1020<br />题目要求我们检测是否能将给定的多个小正方形拼成一个完整的大的正方形。<br />采用搜索遍历的方法:<br />拼凑的方法类似于俄罗斯方块游戏,不同的是每次拼凑的时候必须先找到高度最低的那一列拼凑,如果某一个小正方形不成功的话,则回溯。<br />#include<iostream> using namespace std; const int maxSize = 40;
Mikumikudance
( Mikumikudance+926+64位+Emil繁体汉化版+%2B+MME0.37.zip) ( Mikumikudance+926+64位+Emil繁体汉化版+%2B+MME0.37.zip) 您可以上传小于60MB的文件
HDU 4751 Divide Groups 二分图判断
题目描述:Description(这里原来有一张图但是我不明白有什么卵用我就不放了) This year is the 60th anniversary of NJUST, and to make the celebration more colorful, Tom200 is going to invite distinguished alumnus back to visit and ta