ACM习题
e the new coming jewelrys.
Finally is a integer m (1<=m<=6), indicate the position of new coming jewelrys.
Output
To each test case, output the state of the game when the new comming jewelrys reachd the buttom.
Sample Input
1
WWWWWW
WWWWWW
WWWWWW
WWWWWW
WWWWWW
WWWWWW
WWWWWW
WWWWWW
WWWWWW
WWWWWW
BBWWWW
BBWWWW
OOWWWW
B
B
Y
3
Sample Output
WWWWWW
WWWWWW
WWWWWW
WWWWWW
WWWWWW
WWWWWW
WWWWWW
WWWWWW
WWWWWW
WWWWWW
WWWWWW
WWWWWW
OOYWWW
Source
Author: zsong
Description
Wang Haiyang is a strong and optimistic Chinese youngster. Although born and brought up in the northern inland city Harbin, he has deep love and yearns for the boundless oceans. After graduation, he came to a coastal city and got a job in a marine transportation company. There, he held a position as a navigator in a freighter and began his new life.
The cargo vessel, Wang Haiyang worked on, sails among 6 ports between which exist 9 routes. At the first sight of his navigation chart, the 6 ports and 9 routes on it reminded him of Graph Theory that he studied in class at university. In the way that Leonhard Euler solved The Seven Bridges of Knoigsberg, Wang Haiyang regarded the navigation chart as a graph of Graph Theory. He considered the 6 ports as 6 nodes and 9 routes as 9 edges of the graph. The graph is illustrated as below.
According to Graph Theory, the number of edges related to a node is defined as Degree number of this node.
Wang Haiyang looked at the graph and thought, If arranged, the Degree numbers of all nodes of graph G can form such a sequence: 4, 4, 3,3,2,2, which is called the degree sequence of the graph. Of course, the degree sequence of any simple graph (according to Graph Theory, a graph without any parallel edge or ring is a simple graph) is a non-negative integer sequence?
Wang Haiyang is a thoughtful person and tends to think deeply over any scientific problem that grabs his interest. So as usual, he also gave this problem further thought, As we know, any a simple graph always corresponds with a non-negative integer sequence. But whether a non-negative integer sequence always corresponds with the degree sequence of a simple graph? That is, if given a non-negative integer sequence, are we sure that we can draw a simple graph according to it.?
Let's put forward such a definition: provided that a non-negative integer sequence is the degree sequence of a graph without any parallel edge or ring, that is, a simple graph, the sequence is draw-possible, otherwise, non-draw-possible. Now the problem faced with Wang Haiyang is how to test whether a non-negative integer sequence is draw-possible or not. Since Wang Haiyang hasn't studied Algorithm Design course, it is difficult for him to solve such a problem. Can you help him?
Input
The first line of input contains an integer T, indicates the number of test cases. In each case, there are n+1 numbers; first is an integer n (n<1000), which in
简单模拟对简单模拟的一点理解: 简单模拟题是相对简单一些的题目,对于编程 初学者可以说是练习代码实现能力和代码打字能力 的题目,它基本上涉及不到什么太难的算法...
ACM_入门简单试题[1]_英语考试_外语学习_教育专区。在线评判系统中,一道题目的所有测试数据是放在一个文本文件里的,程序从该文件中读 取测试数据,再把运行结果输...
计算几何 纯数学问题 5 浙江省ACM竞赛的特点简单题:一般2-3道 算法题:一般4-5道 数据结构:一般1-2道 数学相关的题:2-3道 6 训练和练习的方法 分专题训练...
ACM简单题(二) 40页 1下载券 acm简单题 6页 1下载券 acm 简单题2 5页 1下载券 ACM简单题求解 52页 免费 ACM简单练习题 13页 免费 ACM C++简单题 29页...
ACM练习题 28页 1下载券 ACM练习题 50页 3下载券 ACM简单练习题 13页 免费 ACM练习题 16页 1下载券 Acm习题 7页 免费 ACM软件大赛集训练习题-... 21页...
ACM练习题分类表 请所有的新队员认真完成以下各题。如果做题遇到困难,如题意难以...因为题目虽然简单,但是再简单的题目都不能保证一次做对,而做错题的各种原因如...
ACM 练习题(1)描述 浙江工商大学校园里绿树成荫,环境非常舒适,因此也引来一批...ACM简单练习题 13页 免费 acm习题.txt 17页 免费 ACM(美国计算机协会)入门.....
ACM试题解析-1_电脑基础知识_IT/计算机_专业资料。2003 年 ACM-ICPC 南太平洋...此题虽为 ACM 比赛用题,却非常简单,没有什么特别之处,不牵扯数据结构, 实为...
ACM练习题_IT认证_资格考试/认证_教育专区。ACM 练习题 ZDM 一、 高精度运算...ACM简单练习题 13页 免费 ACM(美国计算机协会)入门... 21页 免费 Acm习题 7...
ACM练习题_理学_高等教育_教育专区。ACM练习题ACM contests http://acm.uestc....每一组测试 数据只有一行,为一个简单的四则运算表达式。该行没有其它多余的...
热门文档