我在看一些旧文件时发现的东西。这似乎是一个巧妙的想法,为一个高尔夫挑战代码。
在一年一度的自行车大慈善大赛(CGCC)上最受欢迎的活动之一是火箭自行车论坛。规则很简单:检查抛物面并在wheather上下注是否有可能到达终点线并准确地停下来。那些打赌这是可能的司机必须证明它才能赢。如果他们不能证明的话,赌它的司机就赢了。
,抛物面
这些会议的规则如下:
/、\和_的序列。\,还是通过驱动加速的平坦位_。给定这样的一个抛物线,把它作为第一个程序的输入并输出,不管是否可以按照上面的规则正确地驱动这些抛物面。如果是,将该序列作为第二个程序的输入,并为驱动程序输出一系列指令,说明如何处理平面位。在算例中,分别用+和-对加减速信号进行了信号处理。
输入,输入
Input:
\_///
Formatted for clarity:
/
/
\_/
Validator output:
Falsy (The driver will come to a stop before the last uphill)Input:
\_\__/
Formatted:
\_
\__/
Validator output:
Truthy
Generator output:
--+Input:
\_\_\
Formatted:
\_
\_
\
Validator output:
Falsy (The driver will finish the parcours with at least 1 m/s)/_/\ (Driver can't go uphill with a speed of 0 at the start)
\/_\\/
/\_\//_\
_\/\///_\\
/__//\/_//_\
/_\\\_\/_/__/\_/_\\\\\_\\/\_\//\\\\/\_///\/__\_\_\/_\\\_\//__//_\__/\\___/_\/_/\_\_/\\\\_\_\_\__\_\\
/*
* 提示:该行代码过长,系统自动注释不进行高亮。一键复制会移除系统注释
/*
* 提示:该行代码过长,系统自动注释不进行高亮。一键复制会移除系统注释
* * _/_//_\\//\\\/\/_\/\__\\__//\//_\/_\\\___/\\___\_/\_//\\_\\__\/\\_/_//_/__\/_\\/\\___\_\\\\//_/_\\_\\\_\/\___\_//\\/\\\_/_\///__\//\\\/\\/_\\__\_/\\\/_/_/_//_/_/\\//_\/\/_/\\_\\///_/_\\__/_______\/_///_//_/__//__\_//\\/\\\\\_\\\_\//\_\__/\\\/_\\_\/\_\/_\\_/_\_____/\\_\_/_\/_/\/_/\_\/_\_//_\\//__//\//\//\______\//\_//\/_/\\\/_\__\\/__//\\/\\_\\//_/\\_/_//_\\/\\_/\\/\__/\_\_\\_\_\//__\__\\/_\///___\//\\/\__\/\\\\//__//_/_//\__/\\/___/\\\__\/_\__/_/_/\/\//_\\\/\_/_/_\/__\\_\//___///_/_\//__/\___/_\_/_/\_/_\_/\\\\//\\\\_/_\\/\/__\\/_\_/\//\\_\_\_\_\/_\_//\__\\////////\//_//\//\/\\_/_/___/\/\_\/____/____\\\_///_\_\/\__/\//\_/\\/_/_/\\__\\/\\\\///\//__/\_____\__/\__/\\\__/\\_\/\_\__\/_\\/\_\/\/\\\/_\_\__//_\\/\_\/\\\//\//__\_\_\__\__/\/_\_\_\_/_//\\\\_//\/__\\\\\\___/\/\_\\\\___\\_\\\/\_\__/\_/_/__/__/__\\//_____//_//\___\/\/\/\_\__\__\/_/_/\_//__/\\___/_/_\\/\__\\__\__/\_/_/////\\//\//_\\\\\_\\\\_/\/\_/_//\_/////_///_/\/__\\/_/_\_\/_/\_\__\/\\\_\__/__/_//__\\___/\/\//_\/_\\/\/////__\//_\/__////__\\_//_/\__\/_/__\___//\/\/_/\/\//_\___\/\//\///\/__\_/_/___\/\\_\//__\\\__\/\__//_\\__/\_\/\//\/\__//__/_____\\//__/\\\\\\//_/\_///\/_\\\__/_/\__/\\\//\_\\/\\_\///\_\/\__/\//__\\_\/\\__\__\_/__//\/___\\__/_/_/\__//_//_/\/\_//\//__\\__//\/_///\\\/\__/_\_/__/\__\_/\_/_\\//_/\\/__///\_\/_//\_\\____\_\_\/////_\/_/\\\_//_\_\\\\___/____\/\/_\/_////_\__/_/\/\//_/_\_\__\////\///\_/\/_\____\\//\\__\/\/_\_\_\/\/\\\\/\\__\/_\///\__/\/\\_/_//_//\/\/_////\\\__\\/_/\_/\_\//\/_/_/__\//_\/_\//\\\/\/\_/__\\_\_\//__\_\/_/\/\\\\/__\_/\///\__/____\//\///\_\/\_\/__/\\\__\/\\/\/\_//_/_\_\\__/\/\\_/_\__/\/\/\___\\//_/_\\//__\_\\\\/\_\___/__\\//\\/\_\_\/_/\//\/\/__\_/_______/\_\\__\/_/_/_/\_//__\////\/__//__\/\/\///\_//\/\_//\_//\\_///_/_/__\___\/\/__\\\//__/_\_\_\///_\\_\/_/\\__/_/\\/__/_\/_/_\//\\_\\/__\\\\\/__\______\/_//_/\\\/\/\//_\_//\/\\_\\////\_/\_\\\\/__///_/\\___\/\_\//__//_\__\__/\/\\\/\_/\/_\/_/\__\\/_/\__\/\\/_\\_/\/_\/\_\/\\\\_\_/__\/_/\\\_\/\//\_//\//_/\_/////\\\/__///___/\__//_\\_\\\/\\\___/\/\/\___\____/__////\__\______/__/_//_\\\___//_\_\\\/\\/_/\\_\_/__\__//\/_//_///\//__/\//_/_/_/_/\_\____/_//_____///_\___///_\/__\\/\\//\\_\_\_\_//__//\\__\\_\_/_\//\//\/_\_/_\_//\/\_/_\_/\//_///_/_/\\/_/_/_/_\_\//\_\/\/\/////_/__//\/__\//_\_/__\__\_\_/\\_/_//___/__/_/\///\_\/\/\\__\\\__\/\\/\\/\__//\\\/_/\\/\_\/_//___\\_\/////_\/_\_\__/_//\\\/__/_\\\/\/\_\/__\/\_//\/___/_\\/__\\/_/\\\\/\_//_\/_\/\/\__\\_\\\__\\_/_\///_//_\__/_\_/__///_\__\\_/_\/\___\//_\\_/\\/_/\__/\/_/_\\\\\//_//_\\_///\\\/_\\/\\__\\/__/\_\__\/\//\/_\/\/_\\\/\__\___/_/\/_\\////\\_\___\/\_/__/\/\\__//\//_/_/\\\_/\//\//\/\/_/_\\_/\/\//__/\\/\/_/_\//\/\\_/\//__/\/\////\//__/_/\\\_//_///____//_//\_\/_\_\_\\/\\//__///_\__\/_/_\\/\\\\_\_/\\/_\\_//\\/\\/\\/\_\//_\\//__/_\__/\\_\/\/_/__/\\_\\\_/__/\\\_\_/\___\/_\\//__//_//___\/\/___//_\\___\\/_/_\\_/_\__\/_\_//\_\__/_\//___\\\__//_/__\\\\_/\/\__///____\_/\//_/_\_/___//__\\//\/_/\_\_\\_\//_\_/\_/___\___/\/_//\/_\\\\/\\_____/\/_\/_\_\///_\_/\\//__\__//_/\/\\//___///\\///__\__\////_\\/_/_/_\\\__/\_\/_/_//\_\//_//___/\_/_\\_\_\_///___\/_\__/_/\\/\/_/_\__/_\_/_\__///\\\_/\//_\\_/_\\/\///_\/\__\/_///_\____\/_/\\_//\\_\\_\_\\_\/\\\\\\_\///__\/__\_//\\\/\//__\_\\\_/\/_\_\/\/__/_/\_/\/_\_\__\/_\_//_/\/__\_/_/_//_\/\_\\/_\\\//_\_/\\\\\\_\_/\\/_//_/\_/_/\/\\__/_\/\\\\__/\/_/\//////\\\//\___/_\_//__\__/_/_/_//_\_//\///_\\_\//\\/\//_\_\/\_/_///\\\\_\_\\/_/_\\//\/\/_//\//\_/\_/\\_____/_/\/\/\_\__\///\__\/_/_\\\_\_\___//\__/\_/__//\____/\\\_/\\/__\/_///_//\\_//\__\\_/\/_\_/_\_\\///___/_///\//_/___\///\\\\/\/\\/\___/_/__/\/__/_\_/\/_/\__//_//____\/\\\//_\__/__\_///___///_\//_//__////_\//_//\\___/\/\//_\/_\/\\\\_\//_\\___\_\/_\\\//_\\\/\/\//__\\_\\\_\\\\/___/\/_\____/___//_\\\_/\_\_//_/\_\\_/_\\\__\/_//\\/_/\_/\//_/__////______/\/\/\/_//_\\/\______\__/\/__\__////__/\\__\\_\//__//\_\\\/_//\\_\__\\_/\\/_//\\___/_\///_/\__/_/\///\\//__/_/_/_/////\//\_\\__\_\/\//_/_\\//___/__\/\\___\/\_\__/_/____\__\\____/____/\_/\\///\/\_\\/\\\\//__\//\_//\_/\\_\_/_\/\//\\__\\_//\/_\_/\/_\__/\//\__\/___\__\//\/_\__\__\\//_\_/___/\\_/_//\\\/\/__/_//\/_\_/\/_\/_\/_\\\_//\\__/_//\\/\\_\_\\__/\\\//\__\/\//_\_\/_/_/\___\\\/\\_/\/__\_\_\/\\//_\/\//\_/___/_\\\\\\___/\\_\///\/\_///_//_\_/\\__\__\/_//_\_\\\\/_/__\/\/____/\\\\_\\_/\/_\//_\_\//\_////\/_\___///__\/__/_\/\_//_\\_//_\_\///\/_/\__/__\\_\___//_\____/\///_\/_____\/___/\\\///\/_\/_//__/__/\___\/__//\_///\__///_/_\/_/\_/\_\/\/\\/\///_/_/\\__\_\_\\/\//\\\/\\___//__/_\__/_\\\_\//_/_///\/_///_\//\/\_/\\__\/_\/\_\_\\_\_/__\\_\_\_\__\\__/_\//\_//\_\\//\/___\//__\\/__\\\\//_\_\/_/_/_//_\\_//____\\\_/\\_/_\\\/\\\\\___///\/\__\___\__/_/____/\/_/_\_//\_/\_\___/_/\\_/_\\\\___\/\/\\\/\/\_/___\\_\\\\\\_//////_/_\\\\/\\\\/_\\///\/\/\/\/_\_______/_/\/\/\/_\____\\_\_//\_//__\\\\/\\\\//_\\_/__///_____//\\/_/\\____/__//_\_/__\_\/___\\_\\_/___\////_\__\_\_/_\\\/_\_\/\\_\\/_///\\_//_\_\__/_\/_//_\\///_/\\/\/_\/\_/_//\/\\//\///\\///__/\\//_/\/\_/\_/_\/____/\_\_\//_//_\/\____\_/\\__//\____\\\\__//_\_/_/_/_//\_\\\___\\/\\/\\_///\__\\__\_/_/\/\\__\//\/__/\//_\\__\\__\\\\__\/_\/_/___/\_\\/_\/_\\___///\\_/\_/\__/////_/\\_\_\_//\//\_\__\_\__/__\\//\\_/\\/_\/_/_\/_\/__\\_\\__//\_\__/_/\_\/\_/\////////_///__\_/_\/_/\\\_/\/\\\\/_\\//\////___/_\/\/_\/_/_//___/\/_\__//\///_\//\\//\\//\\___/\\_\\/_/_/\\\/\//\\_\///\__//_\\//\\\_/\/\/\//_///__\_/\\\\\/\\/\\\\\__\\\\\__\_/\\__////\_/\_\/___//_/_/\//\_/\_\\\\/_/_\\/\\/_//\_/\/_\\__//_/_//\/\_/\_\\/_\///_//_///_\/\__\__\_/\\\\/__\_///\\\//_\_\_//__\///__/\/_/\_/\___\//_/\/_\/__\_/_\///_\\/\//\/_/\//\/\///\/\__\__/\\_\__\/\_\//_/_/____//\_//_\\\_\/\\/_/\/\\_/\\\_//__\___\//\_\_\/\//\\/\_/\//_\_/\____///\//\/_/\/\_/_/\///___\_\_\//__\_\__\///\\\_\//_\\/_\\\__/\/\___\\/__//_\\_\_\/_\/__/_\_/_\///____\/\_/\\___\/_\_\_/\_/\\_\//\\\_/\/\/__/\/\__/\__/\//\_\\__/_\///_/__\__\\\/_\\_\___////__\____/\_///\/\_\/___\/\\/\/__\____\/__\__\_/\/////___\\/\\//__/\_\_/_\_\_\____\\/\__\\\/\___\\__\__//\\/\//_\/____\\_//_\_\\\\__//_\/\\/_/_/\_\\\____\\__\//_/\_/___\\\____\_\\\/\\//\_//_\_\\___\\//\/__///_\/_///\/_/_/_/_\____/_\_\___/_\\/\____/\\_/_\\/_/\//\_//___/_____/__/\_\_\_///___/\___\\_/\/\\___\__\/\\\\/\\///_/\\/\\\_\\__\_/\/_\_\\\\_///////\/_/\\\\/\/_//\/__/\_/////\_/\\_/\/_/\///\/\\_//\\_\_\/\\\__\\/_\\_\\\__\/_\_/_/\_/\_\_\\\/_\\\_\_\\___\__///___/\__/_///_\_\__/_\__//\_//\_\_\_\_\/_//_/\\\\////_/___\\_____\\___/\/\\_/___\\\/_\____/\__//////\\\/\_\\__\/_/_/\\\/\/\\_\\\/_//\///______\/_\_/__\\\_\\\____\///____\\\\/_/__//__\/\\/_/_\_\_\_\///_\\__/\\_\/_____/\//__\_///_/\\/_\\/\_/\_//\/\////_/\\\\/\/\\\_\/\_//\/\__/\__//_\/\_//\_\\\\\//\\_\\/\_\\/_//\//__/_\\\\\\_/\____\\\__\\_//\/\___/\/\__/____/\/_\/_/_\_/\__\/\/_\//\_\/_\_\\\__\\/_\///___\/\/\__/__////\__/_\//\\\_\/\//\\_\_/\\__\\///_///\\\_\//__\/\_/\///__\\__\_/_//_\_\___///__/\\\\\\_//__\\_//\___/\//_\\_\\/\\/_/\_\\/\/\\/_\\_\_\/\_/\//\__//////__\_\/_\/\\//_\\\\\\\/_\\\/_//\_/\\/\///_\_\_\\/\____/_/\_\\__/\//___/\//\__///_\/____/_//_\///__/_\/_\\_/__/\/__\\\__/_\_/_/\_\\\_/\_\___//_\/_/\__//////\//\_\\\_/__/_/\\/__\\__//\/_/_//_/\/\_\/_/\__/////_/\\\/\\_\_//\\_/___/\\///__\\/\__\/_\\/_\__\/__\_\/\\_/\__\/\___\\__\__//__\//\//_//_\//_\/_/\\_\\_\_/__//\\\//_/\__///\_\/\\////\\__/_/_///\_\/\_/\_//_\///_/____\\_/\/___\/_\\_\//_\_\//\_//__\_/_/__\_\/_/__\\///\\/\\/\/////_/_/_/_///////__//\__/__//\////\_/__\__\//\_\\//\\_/\__\\/\/\/_\\\\/\_\\\/\/___//\/___\__/\\_\\\\_\\_/\/\_\/\////_//_\_/\//\__//__\\\\\//\\\\\__\_\/\_\//\///\/\\_/_/\/_/___/__\___\/_/_/_\_/\_\//\/\____\\_/\\/_\/\__/_______\\_\//____\__//__/___\\//\\////\/\__\__\\___\\_/____\_/_\/\/_\\__////\\\\___/\\/\//_///_/\___/_////\//__/\__\_/_//\//_/\_\\__//\//_////_\_/\_///___//_\//_/\//__/\_/\\_///\\/\\_/_/_\/__/_\\\__\_/\//\\/_\___\_///_/\/____/_\____///\__//__///\_/\\___\_\_/\/\\/\//\_\/_\\/\\_\\/_//\/\_\__\//_\__//\/__/\/\___/\/_\\_/\_/\_\_/\__/_/\\__/_\__\__\_/\\\__\_/_/\\_\\/_//\_/_\/__\__\_\\__//_\\__/_/\/__///_/_\_/\\\__/_\_____\\/_\\\_\\\/_/_/\/___\\_//\_\_//__\\__/\_/////\___\__\/_/_\/_\/\/\\___//_/_\\__/\/\\///\/\___/__/__/\/__\\//_/_\_/_\/___/__//\\__\\\//\/\\\__/_/\/\\_/_\/\/__/\\/__//_/_/\/\///__//\_/\\\__/___\__\/\\/\_/_\\/_\_\/\\////_//\_\_//__\\/\_\\/\\_\/_\_\/__\\__\\\_/_\\/\/_\\\\//\_\_\\///\\/\/\_\\\\__\//_\/__/\/\___\___\\//\\__\__/\/_/\//__\/\/\\\////____///\_\_\\///\/__/_///_\\/__\__/\/__\\\\_\\_\/___\\_///\\_\_\\\\__\_\___///_\/_/\\\\__\\\_/\//\/_//\\\//\\//\/\__\//__\_/__\\\_/__\//__\//_\_/\/\_\/_\/\__/\_/_/_\/\/_\\\/\/_\/____\_\\__\\\\\_///\\\_/\_\//__\__\__//\/_/_/__\_\\\/\__/__\/_\__/\//\/\\\///_\//\/_/\\_____//\\/\\_____/\/_/_/__\\\__/\\_\//\_\_\_/\/\///_\__/\_//_\//_/\\\___\_\_\/_/_/_\_\//\///_\\\/\_\/\/\_/\_/\\/_//_/__//\/\/_\//_//_/_/_////__/_/__//\/\//_//\/_\\\\/\\__\\_\\___/_/__\\_\/__///\/\_/\/_\//__\/_\\/\__/__/_\/\///_/_\\_\_//___/\/_\_/\//_/\_\_\_\/_///_///\\_\//_/\\\/\\_/\/_\//_\__\_\___\_\\\\\/\\//_/\_/\//_\/_\_///_\/\\/___\\_\_\___\/\/\\////_\__/__\_\\/_/__\_\\\/\////\\___\/_\\\\\_/_/_\__\__//_/_\/_\\\__\__\/_\\\_\_\\/_///_/\/\/__///\\_//__\__/____\_//\/\\\\\_/\\/__\\__/\\\\_\/_\\_/_/_//\/\\///\//_/_\///_\/_/\\//\__///\\\_\/////_\\\/_///_/\\/\/_/_/\__\\/_/\_/\\\_\/\//_/\_/\_/\\\\/\/_/\\/////_/_\\\/\\/_\/\\__\_/__//\\_/_\_//_/_\_/\/_\\_\/\//\_/_\___/__\///////_\_/___\\/_\\\\\//_\\__\\/_/_//\__\_/\///_\///\\/_/\\___/\\\\\\///\\/\_\/\_\_/\\\/\//_/\\_///_/_/\_\/\//_//__//////__/\_/___\___/\\___\\/_/\//\\\\\\/\\_/\/\\/_////_\/___\/__\__/\\___\\_//\_\__\\__//\\\/\/___/\//\/\\\\//\//___//\\\///\/_\\_/\_\\\/\/_/__\\\_\_//\__/__\\___\/_///\\\/_/\//\//___/\/\__\\__\////\__/_/_\\_/\/\_/___/\_\\//_/_//\\\_\\\/\_\/\\//\_/__\\_/_\_\\\/_/__\/_\\\\\/__//\_/\//\//\/\/\///_\__\_\/_///__//\/\/_/\//_\\/\//_///___/_\_/\\/__/\\//__\_\__//_//_/_\\//__/_\_\_/_\/_/_//__/___\\\___\______/_/\//\_/_\\\__//\/_//\\\__/\/////_//\_\\/\_/__\/\/__/\\\\\/_\//_\\\__/_\\_\\/\__\\\/_/__/_\//__///\/\_/\_/_//\\_///\_\/_//\/_\\\\\\\\__\_/\///\/_\_\\\//_/\/\\\/__///\_/___\/\\_\/\/_/\/_///___\__/\/___/\///\///_/\\\/_/\_/\\/\_/\_///_/\\\\/_/__/\/\/_//\/\_//\//__\__/__//\\\/\__/\\\_\__/__/_\//_\\_\_\_\\/_\\/\_/\_/__\
*/
*/_\_/
Generator: +-
\\\_//
Generator: -
\/\_\_
Generator: --
_\\__/\/
Generator: +--
\\_\__\/\/
Generator: ---
\\\__\____\/
Generator: +-----
__\\_/\______/\\\_\/\/_///\\_\//\_\/_\_/__/___/__\\_\_//__\\_/___\_______//\/_//__\/\\\__\/__\__/_\/
Generator: ++++++++++++++++++++++-------------------------
/*
* 提示:该行代码过长,系统自动注释不进行高亮。一键复制会移除系统注释
/*
* 提示:该行代码过长,系统自动注释不进行高亮。一键复制会移除系统注释
* * _/\_//\_\\//___\\//\/\/_\\_\/\\/\_/__\_//\/\__\/\//\\/\/\\\/\\\_//_\/\_\\\/__/\__/\_/_\\__/___/\__\_////\___\/\\\_//\\_\__/\_/\//\/_\/__\//\\_//\\/\/_/\\/_/\_\/\_/__//__/\//_/\_\__\_\_/\////__///__/////_\/__/\\/\_\\/////_\//_/\\\/\//\\/\_\_////\\_\/\_\//_/_/_\\__\\\\\_//\\_/__//\_/\_\/\_//__//__\_\//\_///_/////__\\/\\/\//_______//_\//_/_/__/\/\/_\/__/\///_\_/\/////\/\__///__////_/\\\_\/\___\\\//\/\_\/\////\_/\___\\_\_/_\\__\\___/_\_///\____/\\\/\_/\/\\\\/_\/\/\\\/\\__///___/___\\_///\_/\///__/_/____\\/___\___\\/\__//_\/\\//\_//\_____/____/\/\_\/_\__/\\\/__/_/_/\__/_/_\\/_///__\\\\/_\//_/__\//\_\//_\/_\\_\/__/_\_\\_\\//_//_\_/_\/\\\\/__/\/___//__/_/\/_\/\//___\/_//\/___\__/\/_\//__\\_\///\\/_\_/_\\//\\_//\\\\\_///_\_/__/\_/_/_\\_\_/\/_//_\\/__\\/\\__//__\__\\\\_/\____\___\//\_\_//_/_/__//_\_/_///__/_/__\/\///\_\/_\_/_\\//\//\//\_/\\/\/\///\/\/\\_\//\__\\//__\_\_\\_\_//_\/_/__/__\_\\\_//\\/__\_\\_/\\_/\_////\/_\_\\__\/_\//_\_\/_/__\\//__\_\\\\/__/_\_\/_\\__///\/\_\/\_/\\_\\/\/_\\\//\/\//\_\/_/_/\//\\\/\\/\\_/__/_///__\\/\_\_//_//\//___/___\_/\/\__/\/_/\\\_\\/__\//\/__\_\//\__\/\__\//__\_/_\\_/____/\/_\/__\_\\_//_\\_\\__/_\/_/\\/\\__\\/__//_\/\/\_\/_/__/\/_\_////\\/_\_/\\\_///___\_/__/\/\__/\\_//_\_\_/\/\_\_/\\\/___//__///___\/_\\/_\\\\/__\//\__\\_\\//\/\____\/__///___//\__/_\__\__\\\\\/_\\\//\/\\//__/__\\//\\/\\\__\\\_\_//__/_/\__\_\_/\/\\\_\\//___\_/\/\___/_/\/_\\_\____/\///\/\\\\_/\/_\\_\//\/\/_/_\_//__\\\_\____\/\\_//\\\\\//_/_\_/\\_\/___\/__\_\_\\\\//__\\__\_/_/_\_\\__\_/\///__\/\/__/\__\_\\\/_//\_\//__\/\\/\\/__/\/\\\/____/_\__\\_/_\\\//__//_/_\\//\/\/\_/\_/\\_\//\__/\\/\\_\_/_/\_/_/_/\\_\_//__\/\__\\/_\////____/\_/\//\\//\_/\/_/////_\_\/\/\\////\/\\_/////_\___\\\\\/___\///__//\\__//_\\/\/_//\\__\\//\\/__\\/_\/_/_\_/\__//\__\\\\_/\/\__//_\//_\\___/_/_/___\/_/_\\\\__\_____///__//_//_//\///\//_//\\_\_\_/\/__/\\/\_\/\_///__//_//_\\///_/_/_/\\_\__\\/\____\__//////__\//_/_\\/__/\////\_/\__///\\/\//__\/__/_/_//\//_/\/__/\_/_//\\/\\___/_\\_/\/\_/_\__\__\/\/_/\__\///__////\__/\__/_\\_////////__\/_/____\/_\\\\/\__\\\_\///__\/////_\//\//_\__\/\\__\\_/\/\\//__\_/_\/\//\_\/\\/\\/\\_\\///\\\__//_\\_\//\__//_\/\_///\\/\/\_\//\/____\\____/_/\/_/\/__\\\_/__\\/_/_/\/\\___////__\\/////\___\\/_\_//_\\/_/\//_/\__\/___\__\/\//\/__\_\\\_\/_\//\/\//\/\\///\///\/\_\\//\_\\/\\\____\\\/__/////_\_\///_\\\\_\__\_____\\_///\//\_//\/\_\\_\\/\__/\\/\\_//_\//\\/\_\\_/__/_\/\\/\_///\/\\/\/__/\_\/\\_/\////___\\//\\_\/\//\//\___//\/_/_/_/__\//_/\\_\_\/_/__///\_\\_\\\\_/______\/\\__\/__/_\_/__\/\\___\_/__//\_\/_/_\\_//\/\_/\__/\\\_\\///\_/\\_/_\/\\/_\/_\\\/_\\\_/_\///\\/__//_\\\__/___\\_/\\_\__\\\//\_/_///\_//\/\/\_\\/\\/__\_____//\\_/\/\/\///\_\__\______\//_\\\\/_/\\/\\//_\\_/\\__/__\\\/\\\_/_/\__\_\//____\\\\//\\_/\\/\\\_\///_//\_//\\\/\__//////_/_\//\\\\__/___///_/_///\\_/_/\_\_\//\/__\__//\//\/\/\__\__\\/_\_\//\_//\\\///\\\/_\\____\\\/__\\_/\//\/\\\/\_//_/_\\\_\///__//\_/_/\__//___//_\//\/_\//\\///\__\__//\//\/\/\___///_//_\/\\_/_/_\//__//_\_\\//\/\_//_/_\/\/__/////\_/__\//\/_/\__/\_\\\/_\_/__\\_/_/\///_/\_/\/__/_/\/\/\\//\///\/\\/__\\_\\/_/_\_/\\//\_\\_\______\\_\_\////_\_/\\__/_/\\\\//_\/\_\\_/\_\__\_\\\\///_/__/\__\_\/\____\__/_//\/_\\/_//\/_//\/_/_\_//_/_///_\\\_//\_\_/__///_/\_/___\___/\_\_/\\//_\/_\/////\\_\//_//_/___\/\\/_//\__\__/___//\___/_\\\/\\_/_/_\\//\/_\\_//_//_/\__/_/_/\_\/_\\\/__\\___\___/_//\/_///\_/__/__\__\\\__/_//\\/_/_/__\\\\_\\_\/_\_\\/_/_/\/\\__\/_/__/\//__//_\_/\\\\_\/_\_//\__/\\_///_/\\\/\\/\_/\_\/\\\//\_/_\\_\\//\//\\//___///\\\//\__\_//_//\/_/\/\/__\\\//\/____/___/\__/\\_\_///\//__/_//_\\\\_////\__\//\_/_/_/\\_/_/\\___/\\\\_\_\///\_//_\_\\\/\/\_/__\//_\\/_////_\\_/\___\/___/__/_//_\\/_\/__/\\/__///\\/\/_\\__\///\//\\\\_\\_\/_\_\//\\/\\/\\//\_\\\__/\\\__/\_\\\_/_\\_/\\__/\\/__\\/\\\/__/\//_\/__\___\//___/_//\_//_///__/_/\\\_/_/\_/\_/__///_/_\_\_/\__/\\__/\//\__\/////_/_\\\\\/__\\\___\/___//__\\/\\_\\\\/_/__\_/\/_//\/\_/\\/\_\\/\\_\\\\/\_/_/\/_//_/__/\\\_///_/\/_\\///_\/\/__\\_//\\/\__//_\\__/_\//\\_\_\__\\/\/\/__/\/_\\\\__////_\/_//\\//_/\\/\__/_\/\__/\//_/\__//_\_\//\_//____\\\\_\/\/___\/\/\/___/__\///\/_\___//\_/\__\\_/___///\//_/__/___//_\/__\\\_\/_\\//\__/\____/_/\\/__\///_/\__\\/_/_/___\/_\__\/_\\/\/\_/\_\/\__\\\//\\\/\_\____/\/_\_/\\/__\\///_\_\\//__\_/__\//\___/\_\_//_/___\_/\\\/\\_\///\/_\\/_\_/_\/_\\\_\___\_\//_//\_\_\_\/_\\/\//_\\/\\__////\\__\___\/_/\_/\___/_\_\_\__/__\//\/_\\___\/\\_/\\_\\/_\\__/__\_/\_\__/\//____\//_____\__/\//_\////\//\//\\//__/__/\\\/_//__/\\\_\//\_/\\\\/___\__//_/\\/__\_/\__\/_\//__\_/___/__/_\///\/__/\_\\__/__\/\_\/\/_/\/\_//_\_\/\__\/_\\/////__/_\_/\_/\_/_\/\\_\\\//\_\\\/\_//\//_\__//\//\\\/_\/\/\/\_/_/_/___/\\/\_\\/\\_/\__\/\//////\_/\////\\__/__\\\_//\_///_//\/\_/\/_/\/__\_\__\//_/_/_\\\/\/_/\\__/\_\_\_\_//\\\//___\__/\___\_____\_/\\/__\\\\\_\/__/\\/\____/\//___/_//\/__////\\//_\/\_/\/\\\/_/__\\/\////_\/\/_\/\___/__/\___//\////\\\_\\\_/\////___/\\\\/\_/_//_/\_/\_/\\/\/_//____///___\/\_\_\\//_/\\\/\___\/_\/_/__\//__/____\/\_/_\_\/\//\\_//\///\_\_\_/\\//\_\\_/_/_\__\_\__\//\\/_\_/\_\/__\\//\\//\///\\/\_/_\_\\_///\///_/\//_/\\//\_\_//_/\/\/\\\\/\/\_\_/\//\_\///__\/\\_\___///_\_\//\_\\/\\/\_\\\/_\/__/__/\/_\\_\/\__/\\\_\_//\/_\\/\_///_\//_\\__/__\_//\\\___\__/___///\/\_\\_/\/\/\\\\/\///\_///////\_/\/\\\_//\//\_//\_//\\///_//\/\_\_\/____/\\_\___\_\\//\/\_///_\\/_//_\/_\\\_\_/_\\//\_////\_\_/\\/_//__\\//\_\/_\///\//_\_/\/\_/___\\//__//__\__/_//__/_/_\\_/_\_//\\_\\\/__///\//_/_//\\/_//__\_\\/\_\_\///__/_\/_\\_/\_\\\/\\\__//_///_/\_///__\/\/\_\_/_\/\_/\/\\\\_\\_//\_\\\///\\\/\__\___\_/\/\_\/\/_//_/_\/\\/\_\/_/_\/_/\\___\/_/_/\____//\\\_/\_/_\/\_/__\\\/\/\\\///_\\\\\\/_\__/\_////_/\/_\///\//_\/_/_/\\\___\\\_\//\_\\\_/____/___/_\_\/____\__//\__//\/_\/__\\/\_\___\\//__////__///__\\\_\_\__//_//\_/_\__\_\_/_//_/\\\\_////////__/\__\/\//\//\\\_/\_/_/\_\\///___\\_////_\_\\__/___\_/\_\\\_/_////_//////\\__\\/_\///__///__\_/_/__/_\\/\\\/\\/__/_\_\\\\/\_/___\\_\//_\_\\/\_\/_\///_\__/\_//\/___\__/\_\__\_/_/\\//\/_//_\\\//////\///_//_/_\_//_/_\\_\/\\_/_\\////_\_____\\/\/\_///_\/_/\//_\/\_\\_//\\__\\_/\/___\/__/\/\___/_\\_///\/\/_/\_/\\\_/___\__//_\__//\\/\__/\\_\/\\_/\_\_/_/_/_\\\////_/_/_//__//\\\_/\//\_/\_/\_\/\\___///__\\\__\\_//_/\__/_\_\\/\_/_/\\\///\\//\____\/\_\/\/_\///_\\//___/___\\_\\//\_\\/_\///___\\//\/\\_/\_\\//\\/\_\_/\\\__/_\_\_/\\\\_\\///_//////___\/\\/\/_\\/\\/\/\\\_\\_//\\_\__/__//\/\//\_/\/_//\/\/\/_//___\_\____\/_/\\/__/__/__\\\_\____\_\/_____\_/_/\\_\\__/\___/\_\////_/_\/\__\////_\\//_///_//\____/\_____\\\//\__//\\\/__//_/\\\__/_//_\/___///_\___///_/__//\_/_\/____\_//_\///_//\\/_\//\___\//\\_\/\_/__\_//\/_/_////\\/_///__/\/\__/_\/\/\//\_//_/_///////_//_\_/_\//\_/\\\_\_\/\\\//\\/__/_\/_/\_\\_/_/_\\////\/\_///\_/\/\\\___\\_\/\\\/_\//\/___/\/\_\_\__\_/\\/____/\/___\/_\_\\_\_/\\\\\\/_\/\\/__\\_//\\\//\\__\_\__/_\_\\\_\__\_/_//\_//__//\//___\/__/_____/\\\_/__/\/\/_//\__\///_\/\_\\\//_//_//\/\_\_/\\\__\/\__//\__\\_/__//_//_/_\\__/__\//\_\/\__/\\\_//\_//_/__\///_///\//\\__///\__\/\//__//\_\\//\_\_\_/\///__\\\\//_/\_\\_//\///\___/___/\/___\\_\\/__/\\\///\_//___/_//\\_\\_/_\//\_//_\___/____\/__/__/_\__\/\/_/\///_///___\_//\_\\\/\\//____//_//\\\/_/\/_\/_\\\/\\\__//\_\\/\\//\/_/\\_/__/\_\\//_/\\\__\/\//\\//\_/__\/__/\_\_/\\_\_//\//_/_\\_/_/___/_\_\\\\\_\_\///_\_/_/\__/_\/\_\_\_/_/_//_/_\_\/_\/_\_//\_//_\//\_\/\_/__/___\\\/\\/_/__\_///_/_///\\\/_///_/\_____\__//\\\_/_\\__/\\\__//_\/_\/_\/__\_\//_\___\/\/\\\__\//_/\\//_//_///\_\\\_///__\\/__\\_/_\/\\\\_/\\\/\\/\_\//_/\/_\/_\/////\\\\//__\_/___\/\_//_\/\_//_\///\\\\_\_\_\_\__\_/__/\/__\\//_\/\_/\_\/\__/\_////\/\/\_/\__/\\//\/_/_/\_/__\_/\/\/\_/_/\_/\\\\_\/////___/_\//_/\/_/\______\_\/___/\\\/\/\/_____/__\_//_\\\\_\//_//_\_\\\_/\/\__//\_/\__/////\__/_/_\/\/\\/_/\_\_\\\/\/\\\\/____\/\\\/__\___/_\\//_///_/_/_\/\\\\\_/\_/\\_/\/\\/___/\___\_\/_\/__\/\///_/_\\_//\_///_\_//__/__\\\\_\__\__//\\/_\//\\\//__\/\____/_\//_/_\\/\\\\\_/\_\//\__/\\_/_\/\\_//\\__/__/___/\/\/___/\\/\/\_/\_\\\_//\_\/__\/\//___/_\/____/\_\_/\\/\/\/\__\_//_/_\//\__\\\//\\/\_\/_\////_////\_/_/__\\\\_\//_\\___\_/\///_/_\\\//\__\\_\_/\/_/_\///_/__\//__\/\\___/\\\\_//_\/_\\\\\_\/_\\//\_\\//___//\\_\_/\/_/\/\/\/__\\\\__/\/_//_////\_//_\___/\/\///\/__//_\\_//_///\\_\/_\\\/\/\\\/_/\_\///___/\\\\\/__\/_\/\__\____//\_\_/_\_\\_/__\\\/\_/\////__\_\/_/_/\__\_\__\/\\\/\\//__\\__\/\/\\__\\\_/\\_\/\___/__\\/\\___\////\\_____\\_/\/_\\//___//_\\\//\_\/_\/\______//__/_\_//__/__//___/\/_\_//\//_/_\//_/\//__\/__///\_\\___/_///\_/\///__/_//\/\_//////_/\\_\\_\/\//\\___\\_///\_\_\/__\_/\/\_/__\___\\/__/\_/\_\__\//\\_\\\/_/__\/_///\//____/_\___\///_//\///_/_/\/\\/\_____\__\\//////\\///__\_//\/_//\/\\////_/_____\\_/\///\\__\/\\_//\//_\//__\/_\____\___/__\/\/___/__\_\\__/\/\__\_\__///_\//\_/__///\/\_/\_/\///_/_/_\___/___/_\_/\_/\//\/\\/_//_\__/\\\_/_/__/\///\//\_\/\\/\_\\/\//_\/\\_/\\\\/\_//__/\/_\/\/_//\\//\//_\_\/\/_/_\//\//\__////\\_\\\_///////_/\/____\\\\/_\\/___/\\\//\\/_//__\//_/__\__\___\/\_/\/\//\__/_\__\_\\//\\_\__//\_/\_\\__\/_\\_\/_\/_/__/___\\//_\_\//_\//\\/\/_//\/\\/__\\\/\///_\_\\_////_/\\__/_\\__/__/_\////\//\___/\\/_\__\_\/_\_\\////_////\/_\_//\_\_\/\_/_/_//\_/\/__\/__\/_//_//\\\\__\//\_/\_\\\\//\\\\_\\\____\\/\_\_/\////\_///\___/___\\\\_\\\//\\\\\\/\_\_\_\/_/_//\\/\___\_____\___\/__\/\\__/\/_\\/__\_/\_\__/_/_/_\/\\____\__/\/_/___\/\____\//_\////\_/__/\_\//\//\_/_//\\/\__\_////_\/_/_\/\/__\__\\///\\\\_\\_\/__\\///_/__/_\\/\\\/\\/\_\_/_\\////\_/\_\/\//_/\/_/\\\\///\_/\\__/_\/\/_\/\_//_//\__\___/\_\/___\/___/_/__\//\_\_\__\\/\/_\_//_\_\\_/___//\//\/\\/\_\/\/_/\_\/__\_\/_\__\/\_\///_/_\\\\/\____/\/\_/_\_//\/\/\//_//\\_\\/_\/\_\\__////\_/__/\/\////_//___\/_\\/_/_\_//\_/\\___\///_\/\\_///__/_\/___////_\__\_\__\\/__\___/_/\\\\\\//\\\/\_\/___//_\\_//_/_/\/\_//_/\\\/_/_\_\/\__/\_/_\/\/\_/_/\/__/\_/\\/_\_/\_/\//___\_____/\/_/\/\_\/\_____\\/___/\\__//\_____\\/\_\//\//__\/_\___\\/\_/_/\/\///\__//__\__/\\__/_\_\/_/_//__\////__\_/_\/_\___/_\/\__/_\\_\\//\/\\/___\___/_/\\\\//\___\\\_/_\_\_/_/\_/\/\___\//__\\\\_/_\////\_/_\/__\\/////_\_\_////_\\///__/\/_\__/\___\//_/_/__//_/\\//_//__\/\__/_\///_/__//\_
*/
*/
Generator: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------发电机输出只是一个例子。它不需要像上面看到的那样被“命令”(虽然我认为这是更实用的实现)。
最后一个测试用例可能有10000个字符长,我的计算机现在可能也可能没有试图找到长度为500000的有效的抛物线。
发布于 2022-08-12 16:10:33
g(char*x,int s=0){return*x?*x-47&&g(x+1,s+1)&&(*x=*x-95?32:43)||*x-92&&s&&g(x+1,s-1)&&(*x=*x-95?32:45):!s;}v(char*x,int s=0){return*x?*x-47&&v(x+1,s+1)||*x-92&&s&&v(x+1,s-1):!s;}注意:在这两个函数中,可以通过替换布尔数或用位数来保存4个字节,但这会非常慢。在生成器中,(*x=*x-95?32:43)之前和(*x=*x-95?32:45)之前的and在任何情况下都必须是布尔的(否则它不会输出正确的指令)。
#include <cstring>
#include <cstdio>
f(char*x){int*a=new int[strlen(x)+1],i=a[0]=0,m=0,M=0;for(;x[i];++i)a[i+1]=(a[i]+=(x[i]==92))-(x[i]==47),m=a[i]<m?a[i]:m,M=a[i]>M?a[i]:M;for(;m<=M;++m,puts(""))for(i=0;x[i];++i)putchar(a[i]-m?32:x[i]);}发布于 2022-08-12 20:56:28
®1‚„_\Ik©0¢ãʒ0®r.;ηO¤Ā(ªdP}ZÄ=i,将Validator和Generator程序组合到一个程序中,以保存字节。
输入为字符列表。
输出空字符串为falsey,或将1输出为truthy。此外,将所有可能的生成器输出分别作为减速/加速的-1/1列表。
在网上试试或验证(几乎)所有测试用例.(省略了更大的测试用例;输入的_越多,程序由于ã而变得越慢。)
®1‚ # Push pair [-1,1]
„_\ # Push string "_\"
I # Push the input character-list
k # Get the 0-based index of each character in "_\",
# or -1 if it isn't present (in case of "/")
© # Store this list in variable `®` (without popping)
0¢ # Count the amount of 0s
ã # Get the cartesian product of the [-1,1] with this count
# (resulting in all possible count-sized list of -1s/1s)
ʒ # Filter this list by:
# (implicitly push the current list of -1s/1s
0 # Push a 0
® # Push list `®`
r # Reverse the order of these three
.; # Replace every 0 in list `®` with the -1s/1s of the current list in order
ηO¤Ā(ªdP # Check two things:
# 1. The sum results in exactly 0
# 2. No prefix is negative (so we never have any negative m/s speeds)
η # Get the prefixes of this list
O # Sum each inner prefix-list
¤ # Push the last sum (without popping), which is the sum of the full list
Ā # Check if it's NOT 0 (0 if 0; 1 otherwise)
( # Negate it (0 if 0; -1 otherwise)
ª # Append it to the list
d # Check for each inner integer if it's non-negative (>= 0)
P # Check if this is truthy for all of them
} # Close the filter
# (we now have a list of all possible paths if truthy; or [] if falsey)
Z # Push the flattened maximum (without popping): 1/-1 for truthy; "" for falsey
Ä # Get its absolute value: 1 for truthy; "" for falsey
= # Output it with trailing newline (without popping)
i # And if it was 1:
, # Also output the list itself on another line发布于 2022-08-13 14:02:51
,[------->-[<->---]+<[---[>->+>->>+<[->-]>[.->]<<<<<<[-]]>[->+>+<<]<[-]]>[->->+>+<<<]<,]--[>+<++++++]>>[--<.>]<++>>[--<<.>>]如果parcour是有效的,它只输出指令;否则,它会打印一个或多个字节的值0x01,然后是一些指令(当然这些指令没有意义)。
注意:只有当身高的差值总是小于或等于255时才有效,从一开始就计算在内。
,[------->-[<->---]+<[---[>->+>-<<<[-]]>[->+>+<<]<[-]]>[->->+<<]<,]--[>+<++++++]>>[--<.>]<++>>[--<<.>>]注意:对于这两个程序,输入必须为零结束。只有当输出的+和-的总数小于128时,这两个程序才能工作。
https://codegolf.stackexchange.com/questions/251028
复制相似问题