Giter Site home page Giter Site logo

yonggandewo12 / algorithminjava Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 419 KB

把准备秋招以来看的书上的一些经典算法,以及牛客上每次笔试完之后没做完的题目全部整合,等工作定了空了之后在整理一波,要用的小伙伴们拿去不谢~

Java 100.00%

algorithminjava's Introduction

结果说明

给定的输入为两行,第一行:迷宫大小,第二行:关系 测试方法:进入main函数,从键盘获取输入,输入格式和题中要求一致即可。

要求1:

将迷宫渲染为字符串,且有

无效的数字:输入的字符串无法正确的转换为数字。此时,该函数的输出为字符串 ”Invalid number format . ”

####test: 3 3 0,1 0,2;0,0 1,0;0,1 1,1;0,a 1,2;1,0 1,1;1,1 1,2;1,1 2,1;1,2 2,2;2,0 2,1 输入中含有无效字符a,因此错误。 #####结果:Invalid number format.

数字超出预定范围:数字超出了允许的范围,例如为负数等。此时,该函数的输出为字符串 ”Number out of range . ”

####test: 3 4 0,1 0,2;0,0 1,0;0,1 1,1;0,2 1,2;1,0 1,1;1,1 1,2;1,1 2,1;1,2 2,2;3,0 3,1 #####输入结果中数字含有行数3,按要求这里应该小于行数,否则数组越界,因此错误。 结果: Number out of range.

连通性错误:如果两个网格无法连通,则属于这种错误。此时,该函数的输出为字符串 ”Maze format error.”

####test 3 3 0,1 0,2;0,0 1,0;0,1 1,1;0,2 1,2;1,0 1,1;1,1 1,2;1,1 2,1;1,2 2,2;2,0 1,2 #####最后一个关系不满足相邻且处于邻正南、正北、正东、正西位置,因此错误。 结果: Maze format error.

格式错误:输入命令的格式不符合约定。此时,该函数的输出为字符串 ”Incorrect command format . ”

####test 3 5 ->直接回车或者输入空格 #####第二行参数输入格式有误,故报错 结果:Incorrect command format.

##正确的test举例: ###correctTest 3 3 0,1 0,2;0,0 1,0;0,1 1,1;0,2 1,2;1,0 1,1;1,1 1,2;1,1 2,1;1,2 2,2;2,0 2,1 结果: [W] [W] [W] [W] [W] [W] [W] [W] [R] [W] [R] [R] [R] [W] [W] [R] [W] [R] [W] [R] [W] [W] [R] [R] [R] [R] [R] [W] [W] [W] [W] [R] [W] [R] [W] [W] [R] [R] [R] [W] [R] [W] [W] [W] [W] [W] [W] [W] [W]

algorithminjava's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.