This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| create a robot, it can handle commands as below; | |
| "L" -> turn left | |
| "R" -> turn right | |
| "M" -> forward | |
| "B" -> back | |
| place it on a 2D map(x*y), and pass commands "LLRRLLMMBRL" to this robot, then the robot will move to the target place | |
| example: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 题目一: | |
| 给你一个数学表达式,字符串形式的,只有简单的+-*/操作符,你计算出这个数学表达式的结果 | |
| input> "10*2-(2+5)" | |
| output> 10 | |
| 题目二: | |
| 把上面的程序改成可以支持S表达式 | |
| input> (- (* 10 2) (+ 2 5)) | |
| output> 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module M4 = | |
| type Result<'Success, 'Failure> = | |
| | Success of 'Success | |
| | Failure of 'Failure | |
| type Request = {Name: string; Password: string; NewName: string} | |
| let Process request = | |
| match request with | |
| | {Name = ""} -> Failure "Name must not be blank" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Numerics; | |
| using System.Text; | |
| using System.Threading.Tasks; | |
| namespace mathexpression { | |
| interface Term { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Manipulate2d { | |
| CanvasElement _canvas; | |
| RenderingContext _gl; | |
| int _positionAttri, _translationAttri, _rotationAttri, _scaleAttri; | |
| Buffer _vertexBuffer, _translationBuffer, _rotationBuffer, _scaleBuffer, _indicesBuffer; | |
| UniformLocation _resolutionUniform; | |
| Manipulate2d(c) { | |
| _canvas = c; | |
| _gl = _canvas.getContext3d(preserveDrawingBuffer: true); |
NewerOlder