zoukankan      html  css  js  c++  java
  • 【水】翻译一下某道毒瘤题

    今天好颓……我回去要写一篇博客放在新博客上,叫做:今天好颓啊

    3.石子游戏
    (渣翻译)
    题目描述
    有一天,农夫约翰想要让他的牛通过一个游戏变得更加智慧。于是他就搞了这么一个破游戏。
    游戏规则是这样的:地面上有n个洞。每个洞在一开始都是空的。牛一次可以进行两种操作:(1)把其
    中一个洞用石子盖住。(2)把一个已有石子的洞中的石子拿走。游戏目标是让那些牛能够使每种情况(即每个洞是
    否有石子,可理解为0,1串)都出现过并且只出现过一次并且最后的状态回到所有洞都是空的的状态。
    牛们比较蠢,所以做这个游戏是很麻烦的。比如,以下就是一个不太成功的例子……
    0 000
    1 011
    2 101
    3 100
    4 110
    5 010
    6 011
    7 111
    然后他们就愉快地发现自己卡住了。因为所有仅1个洞为空的情况都出现过了。
    当然也有成功的时候。比如说这个。
    0 000
    1 010
    2 011
    3 001
    4 101
    5 111
    6 110
    7 100
    8 000
    后来他们就开始嫌麻烦了。于是,是的!他们就找到了你。(标准结局)
    输入格式
    一行。一个正整数n。表示洞洞的数量。
    输出格式
    很多行。每行一个0,1串,表示洞洞的状态。用O表示没有石子,X表示有石子

    大部分情况下是意译……

    原题:

    3.The Rock Game (rocks.cpp/in/out)
    简述:n(1<=n<=15)个灯,开始全灭,每次选择一个灯操作(亮--灭,灭--亮),保证每次操作后所有灯的状态
    都与前面不同(0,1 串描述不同),输出从全灭状态开始,到最后全灭状态结束的过程。
    Before the cows head home for rest and recreation, Farmer John wants
    them to get some intellectual stimulation by playing a game.
    The game board comprises N (1 <= N <= 15) identical holes in the
    ground, all of which are initially empty. A cow moves by either
    covering exactly one hole with a rock, or uncovering exactly one
    previously covered hole. The game state is defined by which holes
    are covered with rocks and which aren't. The goal of the game is
    for the cows to reach every possible game state exactly once and
    then return to the state with all holes uncovered.
    The cows have been having a tough time winning the game. Below is
    an example of one of their games:
    Holes
    time 1 2 3
    -----------------
    0 O O O Initially all of the holes are empty
    1 O O X The cow covers hole 3
    2 X O X The cow covers hole 1
    3 X O O The cow uncovers hole 3
    4 X X O The cow covers hole 2
    5 O X O The cow uncovers hole 1
    6 O X X The cow covers hole 3
    7 X X X The cow covers hole 1
    Now the cows are stuck! They must uncover one hole and no matter
    which one they uncover they will reach a state they have already
    reached. For example if they remove the rock from the second hole
    they will reach the state (X O X) which they already visited at
    time 2.
    Below is an example of a valid solution for N=3 holes:
    Holes
    time 1 2 3
    -----------------
    0 O O O Initial state: all of the holes are empty
    1 O X O The cow covers hole 2
    2 O X X The cow covers hole 3
    3 O O X The cow uncovers hole 2
    4 X O X The cow covers hole 1
    5 X X X The cow covers hole 2
    6 X X O The cow uncovers hole 3
    7 X O O The cow uncovers hole 2
    8 O O O The cow uncovers the 1st hole
    which returns the game board to the start having, visited each state once.
    The cows are tired of the game and want your help. Given N, create
    a valid sequence of states that solves the game. If there are
    multiple solutions return any one.
    PROBLEM NAME: rocks
    INPUT FORMAT:
    * Line 1: A single integer: N
    输入:一个整数n
    SAMPLE INPUT (file rocks.in):
    3
    OUTPUT FORMAT:
    * Lines 1..2^N+1: A string of length N containing only 'O' and 'X'
    (where O denotes a uncovered hole and X denotes a covered
    hole). The jth character in this line represents whether the
    jth hole is covered or uncovered in this state. The first and
    last lines must be all uncovered (all O).
    输出:1..2^n+1 行:每行一串,灯的状态,0 表示灭,1 表示亮,第一行全0,最后一行全0
    SAMPLE OUTPUT (file rocks.out):
    OOO
    OXO
    OXX
    OOX
    XOX
    XXX
    XXO
    XOO
    OOO

    本来想写个打表放上来的……可是我连暴力都不会写……

  • 相关阅读:
    Add Two Numbers
    Same Tree
    Single Number
    题目1190:大整数排序
    题目1182:统计单词
    题目1181:遍历链表
    题目1180:对称矩阵
    题目1179:阶乘
    题目1206:字符串连接
    HTML事件
  • 原文地址:https://www.cnblogs.com/aristocrat/p/9047891.html
Copyright © 2011-2022 走看看