VS Code调试golang。 Delve调试器

I have a problem with the Delve debuger in visual studio code. Debugging begins but nothing happens. There is only information in the console:

time="2018-06-23T16:35:55+02:00" level=info msg="launching process with args: [C:\\Users\\LenovoPC\\go\\src\\test\\debug]" layer=debugger

Configuration of launch.json

"version": "0.2.0",
"configurations": [
    {
        "name": "Launch",
        "type": "go",
        "request": "launch",
        "mode": "debug",
        "remotePath": "",
        "port": 2345,
        "host": "127.0.0.1",
        "program": "${workspaceRoot}",
        "env": {},
        "args": [],
        "showLog": true
    }
]

展开翻译

译文

在Visual Studio代码中,Delve调试器出现问题。 调试开始,但没有任何反应。 控制台中只有信息:</ p>

  time =“ 2018-06-23T16:35:55 + 02:00” level = info msg =“使用args启动过程:  [C:\ Users \ LenovoPC \ go \ src \ test \ debug]“ layer = debugger 
</ code> </ pre>

launch.json的配置</ p>

 “ version”:“ 0.2.0”,
“ configuration”:[
{
“ name”:“启动”,
“ type”:“ go “,
” request“:”启动“,
” mode“:”调试“,
” remotePath“:”“,
” port“:2345,
” host“:” 127.0.0.1“ ,
“ program”:“ $ {workspaceRoot}”,
“ env”:{},
“ args”:[],
“ showLog”:true
}
]
</ code > </ pre>
</ div>

dongpiao8821
dongpiao8821 这个launch.json和设置对我有用:stackoverflow.com/a/57746989/2175188。
7 个月之前 回复
du_1993
du_1993 问题出在新的Go版本上。参考github.com/derekparker/delve/issues/1245github.com/Microsoft/vscode-go/issues/1752
接近 2 年之前 回复
drlhsfqoa350437979
drlhsfqoa350437979 不幸的是,它也不起作用。我已经尝试了launch.json文件的所有内容
接近 2 年之前 回复
dongrou2920
dongrou2920 转到调试图标,添加配置,选择启动程序包并删除旧的配置,看看是否可行
接近 2 年之前 回复
doushi9444
doushi9444 这是在调试窗口中。问题窗口清晰可见
接近 2 年之前 回复
ds0678
ds0678 time=“2018-06-23T21:01:55+02:00”level=infomsg=“使用args启动过程:[c:\\Users\\Lenovo\\go\\src\\hello\\debug]“layer=debugger
接近 2 年之前 回复
duancong7358
duancong7358 当您运行调试器时,它是否在“问题”或“调试控制台”中显示任何错误
接近 2 年之前 回复
duancaiyi7567
duancaiyi7567 是的,但是不起作用。我在下面写了一篇文章
接近 2 年之前 回复
drkbpwk609294
drkbpwk609294 您是否尝试过根据我的答案更改设置,然后从main.go运行代码
接近 2 年之前 回复
dsgwdigu84950
dsgwdigu84950 这可能是因为您的工作区根目录路径与您打开的目录不同。
接近 2 年之前 回复

1个回答

Based on how you install delve it will either end up in your PATH or GOPATH/bin. If dlv binary is in your GOPATH/bin and this GOPATH is not set as an environment variable, then make sure your PATH points to this GOPATH/bin so that the Go extension can find the dlv binary.

Try to change the directory to filename to run the project from main.go of your project folder as

{
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Launch",
            "type": "go",
            "request": "launch",
            "mode": "debug",
            "remotePath": "",
            "port": 2345,
            "host": "127.0.0.1",
            "program": "${fileDirname}",
            "env": {},
            "args": [],
            "showLog": true
        }
    ]
}

Make sure $GOPATH is set (e.g. as ~/.go) On terminal run the command

go env

to check for GOROOT and GOPATH variables to see if delve is synchronized with them

For more information Checkout How to configure Delve

展开翻译

译文




根据您安装delve的方式,它最终会出现在PATH或
GOPATH / bin中。 如果dlv二进制文件位于您的GOPATH / bin中,而该GOPATH未设置为
环境变量,则请确保您的PATH指向该nnGOPATH / bin,以便Go扩展程序可以找到dlv二进制文件。</ p>

</ blockquote>

尝试将目录更改为文件名,以从项目文件夹的 main.go </ code>运行项目,</ p>

  {
“ version”:“ 0.2.0”,
“ configuration”:[

{
“ name”:“启动”,
“ type”:“ go”,\ n“请求”:“启动”,
“模式”:“调试”,
“ remotePath”:“”,
“端口”:2345,
“主机”:“ 127.0.0.1”,
“ program”:“ $ {fileDirname}”,
“ env”:{},
“ args”:[],
“ showLog”:true
}
]
}
</ code > </ pre>

确保已设置$ GOPATH(例如〜/ .go)
在终端上运行命令</ p>

  go env 
</ code> </ pre>

检查 GOROOT </ code>和 GOPATH </ code>变量以查看delve是否同步 与他们ronized </ p>

有关更多信息,请参见如何配置Delve </ p>
</ div>

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
win10下vscode调试golang闪一下就没了
![图片说明](https://img-ask.csdn.net/upload/201910/04/1570203866_971906.jpg) ## 问题:配置好了golang环境,点调试红框里面的闪一下就没了,而且没有出现任何调试结果信息,没有报错 ![图片说明](https://img-ask.csdn.net/upload/201910/04/1570203966_721562.jpg) ### 但是如果点这个,或者执行go run main.go 都会运行成功。。。 ![图片说明](https://img-ask.csdn.net/upload/201910/04/1570204077_192261.jpg) ### 这是调试配置 ![图片说明](https://img-ask.csdn.net/upload/201910/04/1570204149_592522.jpg) ### 这是golang环境配置 ![图片说明](https://img-ask.csdn.net/upload/201910/04/1570204241_296192.jpg) ### 这是vscode中的配置 ### 问题出在哪~~~~~~~~~
Golang:对函数的返回值存疑,求解
``` package main import ( "fmt" "math" ) func pow(x, n, lim float64) float64 { if v := math.Pow(x, n); v < lim { return v } else { fmt.Printf("%g >= %g\n", v, lim) } // 这里开始就不能使用 v 了 return lim } func main() { fmt.Println( pow(3, 2, 10), pow(3, 3, 20), ) } ``` 对应的输出为: 27 >= 20 9 20 我想这个代码的输出应该是: 9 10 27 20 谁帮忙解答下呀
golang unexpected directory layout when building
```go goroot: /usr/local/Cellar/go/1.13.3/libexec gopath: /Users/mac/go goVersion: 1.13.3 /Users/mac/go | Makefile src | main mr mrapps .....blablabla ``` ```go unexpected directory layout: import path: _/Users/mac/go/src/mr root: /Users/mac/go/src dir: /Users/mac/go/src/mr expand root: /Users/mac/go expand dir: /Users/mac/go/src/mr separator: / ``` 上面的bug是我用如下代码build的时候碰到的 。。 ``` $ pwd /Users/mac/go/mrapps $ go build -buildmode=plugin wc.go ``` wc.go contents ```import "../mr"``` 这是MIT 6.824网课的lab1 第一步就卡住了。。救救
goland+bootstrapTable
前端页面用的是bootstrapTable 后台用的是go语言 想给参数设置不等于条件应该怎么设置? addParam["<>creater"]="2017081819245511"
Goland html页面中的input标签报错
![图片说明](https://img-ask.csdn.net/upload/202003/20/1584706809_301696.jpg)
TURBO C语言为什么要进行程序调试?程序调试的目的是什么,程序编写了先编译还是先调试?
TURBO C语言为什么要进行程序调试?程序调试的目的是什么,程序编写了先编译还是先调试?
阿里云服务器go get 执行完没有src文件夹
![图片说明](https://img-ask.csdn.net/upload/202003/19/1584592529_562670.png) - 执行完之后进入GOPATH路径ls,结果只有pkg的文件夹,没有src ![图片说明](https://img-ask.csdn.net/upload/202003/19/1584592600_356220.png)
lintcode《给定一个含不同整数的集合,返回其所有的子集》 goalng解题,为什么在alist切片append第24个元素[1,2,3,5]时,会把原来alist中 第16个元素[1,2,3,4]同时修改为[1,2,3,5]?
``` package main import "fmt" func subsets (nums []int) [][]int { // write your code here var alist = [][]int{[]int{}} for _,num :=range nums{ size := len(alist) for i:=0;i<size;i++{ tmp := alist[i] tmp = append(tmp,num) alist = append(alist,tmp) } } return alist } func main(){ var mlist = []int{1,2,3,4,5} fmt.Print(subsets(mlist)) } ``` lintcode题目 17. 子集 给定一个含不同整数的集合,返回其所有的子集。 问题:解题通过golang实现,为什么在alist切片append第24个元素[1,2,3,5]时,会把原来alist中 第16个元素[1,2,3,4]同时修改为[1,2,3,5]?谢谢 没有检查到任何修改alist第16位元素的操作。 15和23地址也不一样啊 alist[15] address:0xc000098168 alist[22] address:0xc000098210 alist[15]:[1 2 3 4] alist[22]:[2 3 5] alist[15] address:0xc000098168 alist[22] address:0xc000098210 alist[23] address:0xc000098228 alist[15]:[1 2 3 5] alist[22]:[2 3 5] alist[23]:[1 2 3 5]
对接微信支付接口文档提示无效的openid
对接微信支付接口文档提示无效的openid,openid是刚获取来的 应该是没问题的 还有一个问题 小程序可以绑定多个商户号吗 我不知道是不是这个问题
C语言编写的程序经过调试以后是不是就没有错误了,为什么还要测试呢
C语言编写的程序经过调试以后是不是就没有错误了,为什么还要测试呢
TURBO C语言编译调试链接三者的顺序和关系是什么,一般来说软件开发先执行哪个步骤?
TURBO C语言编译调试链接三者的顺序和关系是什么,一般来说软件开发先执行哪个步骤?
Golang 返回树状结构 这个结构是append吗
Golang 返回树状结构 这个结构是append吗,如果不是的话是什么?
Code Permutations 写法问题
Problem Description You are soon to graduate from the mathemagician school of Hagworts, and you're quite content with yourself; all the hard work and elbowing has finally paid off. Being successful at most of your endeavors you would normally end up a herald of sound reasoning and good mathemagics. You, however, are different; not only have you spent your young years secretly hacking away at computers, writing code to do your assigned routine homework for you, but of late you have started planning how to cram all your mathemagical skills into a computer to completely eliminate the need for mathemagicians! To show the others just how great a visionary you are, you plan to make your graduation ceremony something they will never forget. To do this you need to break into the safe of your arch-nemesis, Hairy Peter. The safe is locked by a code mechanism: All natural numbers from 1 to N need to be typed in in the correct order, set by Hairy Peter. Fortunately you know that Hairy, being a good mathemagician, has a certain weakness; he has a rather unhealthy obsession with the number K. (For instance he always has to introduce himself K times whenever he meets new people, making him quite annoying to be around.) Thus you are certain that his code, when viewed as a permutation of the N first naturals, has order exactly K. (i.e. K is the smallest positive number such that if you K times replace with the position of x in Hairy's code, you end up with the x you started with, for all x. Thus e.g. the order of the permutation corresponding to the code 2 3 1 is 3, as 1 --> 3 --> 2 --> 1 and 2 --> 1 --> 3 --> 2 and 3 --> 2 --> 1 --> 3.) While this does not help you directly, it greatly reduces the number of code inputs you may have to try before you find the correct one. "How many?" is the question you are pondering right now. You must know the exact number, lest you risk preparing too little time for cracking the safe. Now you also have a certain mathemagical weakness -- arguably a bit worse than Hairy Peter's: Because of your dark scheme to program mathemagical computers, you insist there are no numbers greater than what can be represented by a signed 32-bit integer, namely the prime P = 231 - 1. Of course there must be nothing your computers cannot count. In fact you hate this upper limit P so intensely that you have decided to make a new mathemagics where P equals 0. Ha, take that! (Well, you are quite aware that you are really just counting modulo P, but it will have to suffice until you find better ways of punishing P.) In fact this turns out to be quite an advantage for you! For instance, if the number of code permutations you have to check turns out to be 231, there will actually be just one permutation for you to check, as 231 mod P = 1. (Or at least you think so...) That's just magnificent! Input The input consists of two integers N (1 <= N <= 100) and K (1 <= K <= 231 - 1) respectively. Output The number of permutations of N elements of order K, modulo 231 - 1. Sample Input 3 2 6 6 15 12 Sample Output 3 240 1789014075
shadowsocks或openvpn能否实现虚拟局域网组的构建。以及类似蛤蟆吃的构建思路。
RT <br> 在尝试构建一个P2P_VLAN类平台,目前由于在我所力所能及的方圆内没有源码。 <br> 打算自己写一个借助于OPENVPN或SSR实现的虚拟网组构建。 <br> <h2>1.OPENVPN或SSR可否实现组建虚拟网组?<h2> <h3>2.蛤蟆吃实现的原理?<h3> <br> 两个问题QWQ
Golang 如何进行标准错误输出
我看 go 的 fmt 包中没有输出到标准错误输出的库函数,是没有相关的库函数吗? 答案是: fmt.Fprint(os.Stderr, "to stderr\n") fmt.Fprintf(os.Stderr, "v=%v\n", "to stderr") 吐槽: 为什么 CSDN 的问答不能进行自我回答呢?
golang中使用walk展示二维码图片
![图片说明](https://img-ask.csdn.net/upload/201912/17/1576568318_853567.png) **我的需求是点击生成二维码 在下面展示二维码。 **部分代码如下,初学golang 请教各位大佬** ``` type MyMainWindow struct { *walk.MainWindow hcName *walk.Label userIdName *walk.Label startTime *walk.DateEdit endTime *walk.DateEdit hc, userId *walk.LineEdit imageView *walk.ImageView imageComposite *walk.Composite qrCount int } func (mw *MyMainWindow) ShowQRcode() { if mw.imageComposite != nil { mw.imageComposite.Dispose() } mw.getQRcode() widgets := []Widget{} for i:=1;i<=mw.qrCount;i++ { bitmap, err := walk.NewBitmapFromFile("qrcode/qr_"+strconv.Itoa(i)+".jpg") log.Println("qrcode/qr_"+strconv.Itoa(i)+".jpg") if err != nil { walk.MsgBox(mw, mw.Title(), err.Error(), walk.MsgBoxIconError) break } widget := ImageView{ Image: bitmap, Mode: ImageViewModeZoom, } widgets = append(widgets, widget) } imageComposite := Composite{ AssignTo: &mw.imageComposite, Layout: HBox{}, Children: widgets, } if err := imageComposite.Create(NewBuilder(mw)); err != nil { log.Println(err) } } func openWindow(){ mw := &MyMainWindow{} _, _ = MainWindow{ Title: "梅清打印量上报", MinSize: Size{600, 400}, Size:Size{1200,800}, Layout: VBox{MarginsZero: true}, Children: []Widget{ Composite{ Layout:HBox{}, Children: []Widget{ Label{AssignTo: &mw.hcName,Text: "医院编号"}, LineEdit{AssignTo: &mw.hc,}, Label{AssignTo: &mw.userIdName,Text: "工程师编号"}, LineEdit{AssignTo: &mw.userId,}, DateEdit{AssignTo:&mw.startTime, Format:"yyyy-MM-dd",}, DateEdit{AssignTo:&mw.endTime, Format:"yyyy-MM-dd",}, PushButton{ Text: "生成二维码", OnClicked: func(){ if len(mw.hc.Text()) == 0 { walk.MsgBox(mw, mw.Title(), "请输入医院编号", walk.MsgBoxIconError) log.Println("请输入医院编号") return } if len(mw.userId.Text()) == 0 { walk.MsgBox(mw, mw.Title(), "请输入工程师编号", walk.MsgBoxIconError) log.Println("请输入工程师编号") return } mw.ShowQRcode() }, }, }, }, Composite{ AssignTo:&mw.imageComposite, Layout:HBox{}, }, }, }.Run() } ``` 这是报错信息 ![图片说明](https://img-ask.csdn.net/upload/201912/24/1577177949_302636.png)
golang TCP 发起并发连接accept卡住
测试用例代码如下 并发发起2000个连接会出现 accept卡死的情况 只有drawin和linux系统会有这个问题,windows正常 ```golang func TestStressConn3(t *testing.T) { const max = 2000 var number = 0 l, _ := net.Listen("tcp4", "127.0.0.1:9003") wg := sync.WaitGroup{} wg.Add(max) for i := 0; i < max; i++ { go func() { t.Log("start conn") net.Dial("tcp4", "127.0.0.1:9003") t.Log("end conn") }() } go func() { for { number++ fmt.Println("accept", time.Now().String()) l.Accept() fmt.Println("end", time.Now().String(), number) wg.Done() } }() tm := time.Now() wg.Wait() t.Log("用时", time.Now().Sub(tm).Seconds()) } ```
Code Management System 代码管理编写
Problem Description Jack’s company has a very long program to modify. Each programmer edits some lines of that program and cannot add or delete any lines. A programmer can do three kinds of operations as below: - SYNC: At the beginning, every programmer must do this to download the whole program from the code center to their local machine. This operation only executes once for each programmer. - MODIFY: Modify a line of the code. The modification work will be temporarily done on the local computer. - SUBMIT: Submit one’s whole local code to the code center. The code center will handle all possible changes and then send the whole newest program back to the submitter. We assume that the time duration of handling changes and sending back can be omitted. The code center records the time and the performer of every operation. As you see, a programmer can get the program from the code center only when he performs a SYNC or a SUBMIT operation. We call the version in the code center “standard version.” The code center keeps only ONE standard version. Imagining there are two programmers who download the same version of the program and they both modify the ith line. Then they both submit their programs. Now what will the ith line be in the standard version? Jack figures out a rule. He gives each programmer a unique priority. When a programmer (Let’s name him Tom) modifies the ith line and then submit his program, the code center will handle the content of the ith line following the rules below: 1. If there was no accepted modification on the ith line before, Tom’s modification will be accepted. That means, the ith line in the standard version becomes the same as the ith line in the program submitted by Tom, and so Tom becomes the author of this line. 2. Otherwise, if the time of the last accepted modification on the ith line, is earlier than the time when Tom got the program from code center last time (Tom can get the program by SYNC or SUBMIT operation), Tom’s modification will be accepted. This situation means that there was no newly accepted modification on the ith line during the time from the ith line’s last accepted modification to Tom’s submission. 3. Otherwise, if Tom’s priority is higher than the priority of the last author of the ith line, Tom’s modification will be accepted. 4. In other cases, Tom’s modification on the ith line this time will be ignored and never be processed again. 5. If Tom’s modification was accepted, the code center would record the modification time of the ith line as the time when Tom’s SUBMIT operation happened. Please note that a programmer can modify multiple lines before he submits, and his modification on some lines may be accepted, but on the other lines may be ignored. For example, Alice and Bob are two programmers. Alice’s priority is 1 and Bob’s is 2(2 is higher than 1). In following case A and B, Bob’s modification on the first line will be accepted. However, Alice’s modification will be ignored in Case C but will be accepted in Case D. Case A [2010/07/18 12:00:00] Alice SYNC [2010/07/18 12:00:01] Bob SYNC Alice and Bob are editing the first line. [2010/07/18 12:05:00] Alice SUBMIT [2010/07/18 12:06:00] Bob SUBMIT Case B [2010/07/18 12:00:00] Alice SYNC Alice is editing the first line. [2010/07/18 12:05:00] Alice SUBMIT [2010/07/18 12:05:01] Bob SYNC Bob is editing the first line [2010/07/18 12:06:00] Bob SUBMIT Case C [2010/07/18 12:00:00] Alice SYNC [2010/07/18 12:00:02]Bob SYNC Alice and Bob are editing the first line. [2010/07/18 12:05:00]Bob SUBMIT [2010/07/1812:06:00]Alice SUBMIT Case D [2010/07/18 12:00:00] Bob SYNC Bob is editing the first line. [2010/07/18 12:05:00]Bob SUBMIT [2010/07/18 12:05:01]Alice SYNC Alice is editing the first line [2010/07/18 12:06:00]Alice SUBMIT You need to help Jack to figure out who is the last author of every code line in the final standard version of the program. Input The input contains several test cases. For each test case, the first line contains an integer n (0<n<=10000), representing the number of programmers. The following lines contain their working details. For each programmer, the first line contains a string and two integers pi and qi. The string represents his/her name, which only contains letters. The length of each name is less than 30. pi is his/her priority number and qi is the number of operations his/her has done. Each of the following qi lines contains a single operation. The format is as following: “[yyyy/mm/dd hh:mm:ss] OPERATION” There is a blank between day(dd) and hour(hh), as well as the right square bracket and OPERATION. The OPERATION has three formats: “SYNC”, “MODIFY line_id” and “SUBMIT”. The line_id was an integer representing the certain line number on which this modification happens. There is a blank between MODIFY and line_id. There is no extra blank. The line numbers and priority numbers are integers from 0 to 231-1. The sum of all the qi is less than or equal to 50000. You can assume that all operations happen in different time. The input file ends by a single 0 in a line. Output For each test case, details of each modified line should show in a line. The format is as follows: “line_id [yyyy/mm/dd hh:mm:ss] BY name” The line_id is the certain line which has been modified. The date shows the time of its last accepted modification and name shows the author. There’s a single white blank between line_id and the left bracket, as well as the day(dd) and hour(hh), the right bracket and “BY”, “BY” and name. Beside these, there’s no spare white blank. The lines are sorted increasingly by line_id. At the end of each test case, there is a single line contains a word “END”. Sample Input 2 Alice 1 3 [2010/07/18 12:00:00] SYNC [2010/07/18 12:01:00] MODIFY 1 [2010/07/18 12:05:00] SUBMIT Bob 2 3 [2010/07/18 12:00:01] SYNC [2010/07/18 12:01:30] MODIFY 1 [2010/07/18 12:06:00] SUBMIT 2 Alice 1 3 [2010/07/18 12:05:01] SYNC [2010/07/18 12:05:30] MODIFY 1 [2010/07/18 12:06:00] SUBMIT Bob 2 3 [2010/07/18 12:00:01] SYNC [2010/07/18 12:01:30] MODIFY 1 [2010/07/18 12:05:00] SUBMIT 0 Sample Output 1 [2010/07/18 12:06:00] BY Bob END 1 [2010/07/18 12:06:00] BY Alice END
Serial Numbers 序列号的问题
Problem Description A manufacturer keeps an ordered table of serial numbers by listing in each row of the table a range of serial numbers along with two corresponding pieces of information called the status code and the transfer code. A four-column table stores information about ranges of serial numbers in this order: starting serial number, ending serial number, status code, transfer code. Serial numbers as well as transfer codes are integers from 1 to 2147483647, and status codes are a single upper-case letter. The table is maintained in increasing order of serial numbers, serial number ranges are never allowed to overlap, and for any given serial number, the table must always accurately represent the most recent data (status code and transfer code) for that serial number. Let's say that 100,000 serial numbers are created with a status of "A" and a transfer code of "1". An entry for those serial numbers might look like this: 1 100000 A 1 This is obviously far more efficient than storing 100,000 individual rows all with the same status and transfer codes. The challenge arises when serial numbers within already defined ranges need to be given different status or transfer codes. For example, if serial number 12345 needs to change to status B, the above table would need to become three separate entries: 1 12344 A 1 12345 12345 B 1 12346 100000 A 1 Now let's change the transfer code of all serial numbers in the range 12000 to 12999 to 2. This gets us: 1 11999 A 1 12000 12344 A 2 12345 12345 B 2 12346 12999 A 2 13000 100000 A 1 Now change all existing serial numbers from 10000 to 100000 to status C and transfer code 2: 1 9999 A 1 10000 100000 C 2 Once created a serial number will never be deleted, but it is possible to have ranges of undefined serial numbers between ranges of defined ones. To demonstrate, let's now set all serial numbers from 1000000 to 1999999 to status Z and transfer code 99: 1 9999 A 1 10000 100000 C 2 1000000 1999999 Z 99 Finally, the table is always maintained with a minimal number of rows, meaning specifically that there will never be two adjacent rows in the table where one would suffice. For example, consider the following serial number table: 1 10 A 1 11 20 A 1 21 30 B 1 The first two rows could actually be represented by a single row, meaning that the table above does not have a minimal number of rows. The same data represented by a minimal number of rows would look like this: 1 20 A 1 21 30 B 1 The following table, however, because the first two rows have non-matching transfer codes, already contains the minimal number of rows: 1 10 A 1 11 20 A 2 21 30 B 1 Similarly, the following table cannot be reduced further because the first two rows do not represent a continuous series of serial numbers: 1 10 A 1 12 20 A 1 21 30 B 1 Input Each input case begins with a single line that is a character string naming the test case. This string contains at most 80 characters. The name "END" marks the end of the input. Following this will be 1 to 100 lines of the form "A B S T", where A, B, and T are integers in the range 1 to 231-1, S is an uppercase letter, and A<=B. These lines are, in the order they are to be applied, the serial number transactions to be recorded, where A is the start of the serial number range, B is the end of the serial number range, S is the status code, and T is the transfer code. The list of serial number transactions is terminated by a line containing only a 0 (zero) character. Output For each input case, echo the test case name to the output on a line by itself, followed by the resulting minimal-rows serial number table that results after all serial number transactions have been applied. Sample Input First Example 1 100000 A 1 12345 12345 B 1 0 And Another 1 100000 A 1 12345 12345 B 1 12000 12999 A 2 12345 12345 B 2 0 Test Case Three 1 100000 A 1 12345 12345 B 1 12000 12999 A 2 12345 12345 B 2 10000 100000 C 2 0 Example Four 1 100000 A 1 12345 12345 B 1 12000 12999 A 2 12345 12345 B 2 10000 100000 C 2 1000000 1999999 Z 99 0 Example 5 1 10 A 1 21 30 B 1 11 20 A 1 0 Example 6 21 30 B 1 1 10 A 1 11 20 A 2 0 Example 7 12 20 A 1 21 30 B 1 1 10 A 1 0 END Sample Output First Example 1 12344 A 1 12345 12345 B 1 12346 100000 A 1 And Another 1 11999 A 1 12000 12344 A 2 12345 12345 B 2 12346 12999 A 2 13000 100000 A 1 Test Case Three 1 9999 A 1 10000 100000 C 2 Example Four 1 9999 A 1 10000 100000 C 2 1000000 1999999 Z 99 Example 5 1 20 A 1 21 30 B 1 Example 6 1 10 A 1 11 20 A 2 21 30 B 1 Example 7 1 10 A 1 12 20 A 1 21 30 B 1
Bit Magic 二进制的计算
Problem Description Yesterday, my teacher taught me about bit operators: and (&), or (|), xor (^). I generated a number table a[N], and wrote a program to calculate the matrix table b[N][N] using three kinds of bit operator. I thought my achievement would get teacher's attention. The key function is the code showed below. There is no doubt that my teacher raised lots of interests in my work and was surprised to my talented programming skills. After deeply thinking, he came up with another problem: if we have the matrix table b[N][N] at first, can you check whether corresponding number table a[N] exists? Input There are multiple test cases. For each test case, the first line contains an integer N, indicating the size of the matrix. (1 <= N <= 500). The next N lines, each line contains N integers, the jth integer in ith line indicating the element b[i][j] of matrix. (0 <= b[i][j] <= 2 31 - 1) Output For each test case, output "YES" if corresponding number table a[N] exists; otherwise output "NO". Sample Input 2 0 4 4 0 3 0 1 24 1 0 86 24 86 0 Sample Output YES NO
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
Python——画一棵漂亮的樱花树(不同种樱花+玫瑰+圣诞树喔)
最近翻到一篇知乎,上面有不少用Python(大多是turtle库)绘制的树图,感觉很漂亮,我整理了一下,挑了一些我觉得不错的代码分享给大家(这些我都测试过,确实可以生成) one 樱花树 动态生成樱花 效果图(这个是动态的): 实现代码 import turtle as T import random import time # 画樱花的躯干(60,t) def Tree(branch, ...
程序员请照顾好自己,周末病魔差点一套带走我。
程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。
我是Leader,我被降职成了普通员工,HR说:公司要梯队年轻化
“BAT也不是完美的避风港哇~”这是老刘说的,老刘是BAT某家的一个Leader,职级约类似T7(T族一般是技术族,管理是M族),在BAT某家呆了11年,但是在整个互联网行业推崇,梯队年轻化的氛围时,老刘所在的业务线,产品数据并不是太好看。于是前段时间被约谈了,只是从Leader变成了一线技术,薪水没太大变化,但是已经不是管理层队伍了,团队里的更年轻的人成了他的汇报对象,在这种职场角色反转的事情,...
计算机专业的书普遍都这么贵,你们都是怎么获取资源的?
介绍几个可以下载编程电子书籍的网站。 1.Github Github上编程书资源很多,你可以根据类型和语言去搜索。推荐几个热门的: free-programming-books-zh_CN:58K 星的GitHub,编程语言、WEB、函数、大数据、操作系统、在线课程、数据库相关书籍应有尽有,共有几百本。 Go语言高级编程:涵盖CGO,Go汇编语言,RPC实现,Protobuf插件实现,Web框架实...
小白学 Python 爬虫(25):爬取股票信息
人生苦短,我用 Python 前文传送门: 小白学 Python 爬虫(1):开篇 小白学 Python 爬虫(2):前置准备(一)基本类库的安装 小白学 Python 爬虫(3):前置准备(二)Linux基础入门 小白学 Python 爬虫(4):前置准备(三)Docker基础入门 小白学 Python 爬虫(5):前置准备(四)数据库基础 小白学 Python 爬虫(6):前置准备(...
这三名男子靠开加密矿池获得7.22 亿美元,却不兑现收益拿去奢侈挥霍……
来源 /cointelegraph编译/火火酱责编 / Carol出品 / 区块链大本营(blockchain_camp)根据美国司法部12月10日发布的声明,美国新泽西州当局宣布...
卸载 x 雷某度!GitHub 标星 1.5w+,从此我只用这款全能高速下载工具!
作者 | Rocky0429 来源 | Python空间 大家好,我是 Rocky0429,一个喜欢在网上收集各种资源的蒟蒻… 网上资源眼花缭乱,下载的方式也同样千奇百怪,比如 BT 下载,磁力链接,网盘资源等等等等,下个资源可真不容易,不一样的方式要用不同的下载软件,因此某比较有名的 x 雷和某度网盘成了我经常使用的工具。 作为一个没有钱的穷鬼,某度网盘几十 kb 的下载速度让我...
2019年还剩1天,我从外包公司离职了
这日子过的可真快啊,2019年还剩1天,外包公司干了不到3个月,我离职了
只因接了一个电话,程序员被骗 30 万!
今天想给大家说一个刚刚发生在我身边的一起真实的诈骗经历,我的朋友因此被骗走30万。注:为了保护当事人隐私,部分情节进行了修改。1平安夜突来的电话开始以为就像普通的诈骗一样,想办法让你把钱...
一名大专同学的四个问题
【前言】   收到一封来信,赶上各种事情拖了几日,利用今天要放下工作的时机,做个回复。   2020年到了,就以这一封信,作为开年标志吧。 【正文】   您好,我是一名现在有很多困惑的大二学生。有一些问题想要向您请教。   先说一下我的基本情况,高考失利,不想复读,来到广州一所大专读计算机应用技术专业。学校是偏艺术类的,计算机专业没有实验室更不用说工作室了。而且学校的学风也不好。但我很想在计算机领...
复习一周,京东+百度一面,不小心都拿了Offer
京东和百度一面都问了啥,面试官百般刁难,可惜我全会。
Java 14 都快来了,为什么还有这么多人固守Java 8?
从Java 9开始,Java版本的发布就让人眼花缭乱了。每隔6个月,都会冒出一个新版本出来,Java 10 , Java 11, Java 12, Java 13, 到2020年3月份,...
达摩院十大科技趋势发布:2020 非同小可!
【CSDN编者按】1月2日,阿里巴巴发布《达摩院2020十大科技趋势》,十大科技趋势分别是:人工智能从感知智能向认知智能演进;计算存储一体化突破AI算力瓶颈;工业互联网的超融合;机器间大规模协作成为可能;模块化降低芯片设计门槛;规模化生产级区块链应用将走入大众;量子计算进入攻坚期;新材料推动半导体器件革新;保护数据隐私的AI技术将加速落地;云成为IT技术创新的中心 。 新的画卷,正在徐徐展开。...
面试官刁难:Java字符串可以引用传递吗?
老读者都知道了,六年前,我从苏州回到洛阳,抱着一幅“海归”的心态,投了不少简历,也“约谈”了不少面试官,但仅有两三个令我感到满意。其中有一位叫老马,至今还活在我的手机通讯录里。他当时扔了一个面试题把我砸懵了:“王二,Java 字符串可以引用传递吗?” 我当时二十三岁,正值青春年华,从事 Java 编程已有 N 年经验(N &lt; 4),自认为所有的面试题都能对答如流,结果没想到啊,被“刁难”了—...
轻松搭建基于 SpringBoot + Vue 的 Web 商城应用
首先介绍下在本文出现的几个比较重要的概念: 函数计算(Function Compute): 函数计算是一个事件驱动的服务,通过函数计算,用户无需管理服务器等运行情况,只需编写代码并上传。函数计算准备计算资源,并以弹性伸缩的方式运行用户代码,而用户只需根据实际代码运行所消耗的资源进行付费。Fun: Fun 是一个用于支持 Serverless 应用部署的工具,能帮助您便捷地管理函数计算、API ...
讲真,这两个IDE插件,可以让你写出质量杠杠的代码
周末躺在床上看《拯救大兵瑞恩》 周末在闲逛的时候,发现了两个优秀的 IDE 插件,据说可以提高代码的质量,我就安装了一下,试了试以后发现,确实很不错,就推荐给大家。 01、Alibaba Java 代码规范插件 《阿里巴巴 Java 开发手册》,相信大家都不会感到陌生,其 IDEA 插件的下载次数据说达到了 80 万次,我今天又贡献了一次。嘿嘿。 该项目的插件地址: https://github....
Python+OpenCV实时图像处理
目录 1、导入库文件 2、设计GUI 3、调用摄像头 4、实时图像处理 4.1、阈值二值化 4.2、边缘检测 4.3、轮廓检测 4.4、高斯滤波 4.5、色彩转换 4.6、调节对比度 5、退出系统 初学OpenCV图像处理的小伙伴肯定对什么高斯函数、滤波处理、阈值二值化等特性非常头疼,这里给各位分享一个小项目,可通过摄像头实时动态查看各类图像处理的特点,也可对各位调参、测试...
2020年一线城市程序员工资大调查
人才需求 一线城市共发布岗位38115个,招聘120827人。 其中 beijing 22805 guangzhou 25081 shanghai 39614 shenzhen 33327 工资分布 2020年中国一线城市程序员的平均工资为16285元,工资中位数为14583元,其中95%的人的工资位于5000到20000元之间。 和往年数据比较: yea...
为什么猝死的都是程序员,基本上不见产品经理猝死呢?
相信大家时不时听到程序员猝死的消息,但是基本上听不到产品经理猝死的消息,这是为什么呢? 我们先百度搜一下:程序员猝死,出现将近700多万条搜索结果: 搜索一下:产品经理猝死,只有400万条的搜索结果,从搜索结果数量上来看,程序员猝死的搜索结果就比产品经理猝死的搜索结果高了一倍,而且从下图可以看到,首页里面的五条搜索结果,其实只有两条才是符合条件。 所以程序员猝死的概率真的比产品经理大,并不是错...
害怕面试被问HashMap?这一篇就搞定了!
声明:本文以jdk1.8为主! 搞定HashMap 作为一个Java从业者,面试的时候肯定会被问到过HashMap,因为对于HashMap来说,可以说是Java集合中的精髓了,如果你觉得自己对它掌握的还不够好,我想今天这篇文章会非常适合你,至少,看了今天这篇文章,以后不怕面试被问HashMap了 其实在我学习HashMap的过程中,我个人觉得HashMap还是挺复杂的,如果真的想把它搞得明明白...
毕业5年,我问遍了身边的大佬,总结了他们的学习方法
我问了身边10个大佬,总结了他们的学习方法,原来成功都是有迹可循的。
python爬取百部电影数据,我分析出了一个残酷的真相
2019年就这么匆匆过去了,就在前几天国家电影局发布了2019年中国电影市场数据,数据显示去年总票房为642.66亿元,同比增长5.4%;国产电影总票房411.75亿元,同比增长8.65%,市场占比 64.07%;城市院线观影人次17.27亿,同比增长0.64%。 看上去似乎是一片大好对不对?不过作为一名严谨求实的数据分析师,我从官方数据中看出了一点端倪:国产票房增幅都已经高达8.65%了,为什...
推荐10个堪称神器的学习网站
每天都会收到很多读者的私信,问我:“二哥,有什么推荐的学习网站吗?最近很浮躁,手头的一些网站都看烦了,想看看二哥这里有什么新鲜货。” 今天一早做了个恶梦,梦到被老板辞退了。虽然说在我们公司,只有我辞退老板的份,没有老板辞退我这一说,但是还是被吓得 4 点多都起来了。(主要是因为我掌握着公司所有的核心源码,哈哈哈) 既然 4 点多起来,就得好好利用起来。于是我就挑选了 10 个堪称神器的学习网站,推...
这些软件太强了,Windows必装!尤其程序员!
Windows可谓是大多数人的生产力工具,集娱乐办公于一体,虽然在程序员这个群体中都说苹果是信仰,但是大部分不都是从Windows过来的,而且现在依然有很多的程序员用Windows。 所以,今天我就把我私藏的Windows必装的软件分享给大家,如果有一个你没有用过甚至没有听过,那你就赚了????,这可都是提升你幸福感的高效率生产力工具哦! 走起!???? NO、1 ScreenToGif 屏幕,摄像头和白板...
(总结)阿里面试问了ArrayList,都问了啥?
我是真的没想到,面试官会这样问我ArrayList。
曾经优秀的人,怎么就突然不优秀了。
职场上有很多辛酸事,很多合伙人出局的故事,很多技术骨干被裁员的故事。说来模板都类似,曾经是名校毕业,曾经是优秀员工,曾经被领导表扬,曾经业绩突出,然而突然有一天,因为种种原因,被裁员了,...
大学四年因为知道了这32个网站,我成了别人眼中的大神!
依稀记得,毕业那天,我们导员发给我毕业证的时候对我说“你可是咱们系的风云人物啊”,哎呀,别提当时多开心啦????,嗯,我们导员是所有导员中最帅的一个,真的???? 不过,导员说的是实话,很多人都叫我大神的,为啥,因为我知道这32个网站啊,你说强不强????,这次是绝对的干货,看好啦,走起来! PS:每个网站都是学计算机混互联网必须知道的,真的牛杯,我就不过多介绍了,大家自行探索,觉得没用的,尽管留言吐槽吧???? 社...
良心推荐,我珍藏的一些Chrome插件
上次搬家的时候,发了一个朋友圈,附带的照片中不小心暴露了自己的 Chrome 浏览器插件之多,于是就有小伙伴评论说分享一下我觉得还不错的浏览器插件。 我下面就把我日常工作和学习中经常用到的一些 Chrome 浏览器插件分享给大家,随便一个都能提高你的“生活品质”和工作效率。 Markdown Here Markdown Here 可以让你更愉快的写邮件,由于支持 Markdown 直接转电子邮...
看完这篇HTTP,跟面试官扯皮就没问题了
我是一名程序员,我的主要编程语言是 Java,我更是一名 Web 开发人员,所以我必须要了解 HTTP,所以本篇文章就来带你从 HTTP 入门到进阶,看完让你有一种恍然大悟、醍醐灌顶的感觉。 最初在有网络之前,我们的电脑都是单机的,单机系统是孤立的,我还记得 05 年前那会儿家里有个电脑,想打电脑游戏还得两个人在一个电脑上玩儿,及其不方便。我就想为什么家里人不让上网,我的同学 xxx 家里有网,每...
立即提问