高尔夫代码:验证数独网格 [英] Code Golf: Validate Sudoku Grid

查看:125
本文介绍了高尔夫代码:验证数独网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有效的Sudoku网格由数字1到9填充,在每个9个行或列的子块中,没有一个以上的数字出现一次。如果您不熟悉此流行难题,请阅读这篇文章了解更多详细信息。

A valid Sudoku grid is filled with numbers 1 to 9, with no number occurring more than once in each sub-block of 9, row or column. Read this article for further details if you're unfamiliar with this popular puzzle.

挑战在于编写最短的程序来验证可能未满的Sudoku网格。

The challenge is to write the shortest program that validates a Sudoku grid that might not be full.

输入将是一个9行的字符串,每行9个字符,代表网格。空单元格将由表示。如果网格有效,您的输出应为有效,否则输出为 Invalid

Input will be a string of 9 lines of 9 characters each, representing the grid. An empty cell will be represented by a .. Your output should be Valid if the grid is valid, otherwise output Invalid.

123...789
...456...
456...123
789...456
...123...
564...897
...231...
897...564
...564...



输出



Output

Valid



输入



Input

123456789
987654321
123456789
123456789
987654321
123456789
123456789
987654321
123456789



输出



Output

Invalid



《高尔夫规则》



请以能够解决此问题的任何语言发布最短的代码。输入和输出可以通过stdin和stdout或您选择的其他文件来处理。

Code Golf Rules

Please post your shortest code in any language that solves this problem. Input and output may be handled via stdin and stdout or by other files of your choice.

Winner将是使用实现的语言中最短的解决方案(按字节数)。在发布此问题之前已存在。因此,尽管您可以自由使用刚提交的语言来提交0字节的解决方案,但该解决方案将不起作用,并且您可能会投票否决。

Winner will be the shortest solution (by byte count) in a language with an implementation existing prior to the posting of this question. So while you are free to use a language you've just made up in order to submit a 0-byte solution, it won't count, and you'll probably get downvotes.

推荐答案

Golfscript:56



Golfscript: 56

n%{zip''+9/.{'.'-..&=}%$0=\}:|2*{3/}%|;**"InvV"3/="alid"

这篇关于高尔夫代码:验证数独网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆