我们的教条是:
◦ 经历苦痛才可抵达乐园。
◦ 思考是人生成功的源泉。
◦ 清楚的知道你要做什么。
遇到一些事情的时候,分心,因为总想要以一个好的状态来办事,所以当有一些坏感觉出现的时候,就分心去想办法解决坏感觉。最终一事无成。 目前自己想到并接受的方法:不管这些坏感觉,出现就出现吧,难受就难受吧,办事情更重要。一边难受一边办事也不是办不了。 绝对不要拖延,越拖遗憾越多,要勇敢的去验证,去实践。不能错失良机。不能害怕。
有很多诱惑,比如晚上睡前看视频,虽然这个能带来力量,就是学习的时候或者白天想到晚上可以放松,就会给精神加分,但是成瘾性很难解决。 关于多巴胺。多巴胺和成瘾。奖赏机制。多巴胺是一种对快乐的渴望,而不是快乐本身。 多巴胺欲望回路。脑回路会被多巴胺重塑。多巴胺喜欢意外。 要警惕会导致多巴胺大起大落的一切行为。 多巴胺带来的是想象,对美好的想象。想象和现实的偏差,是让人痛苦的。 多巴胺,成瘾是有规律的。 用享受当下来代替美好幻想。追求和拥有。 比如刷视频,刷图片,刷帖子。这是因为多巴胺制作了对未来的美好想象,多巴胺想要更多,如果不被及时满足,就会继续幻想并追求下一个。 因为当前的多巴胺应对的事物结束时,多巴胺跌落,人会十分难受,所以便会立马带动多巴胺,激发想象,追求下一段“美好”。 解决方法:在当前的美好进行中时,及时满足,在进行到一半的时候察觉,在即将结束时降低多巴胺,进行满足。并尝试找代替。 比如:从刷视频,刷文字 -> 听音乐,看书 引申思考:利用多巴胺来激励深层研究、学习、考究、收集、思考。
初次尝试使用hugo建站,已经管不了那么多了,不能再继续耽误下去了。 然后
本题的目的是识别3000年前古埃及用到的6种象形文字,如图6-10所示。 图6-10 古代象形符号 每组数据包含一个H行W列的字符矩阵(H≤200,W≤50),每个字符为4个相邻像素点的 十六进制(例如,10011100对应的字符就是9c)。转化为二进制后1表示黑点,0表示白点。 输入满足: 不会出现上述6种符号之外的其他符号。 输入至少包含一个符号,且每个黑像素都属于一个符号。 每个符号都是一个四连块,并且不同符号不会相互接触,也不会相互包含。 如果两个黑像素有公共顶点,则它们一定有一个相同的相邻黑像素(有公共边)。 符号的形状一定和表6-9中的图形拓扑等价(可以随意拉伸但不能拉断)。 要求按照字典序输出所有符号。例如,图6-11中的输出应为AKW。 样例参见 https://www.udebug.com/UVa/1103 本家连接 分为以下几个步骤: 关键在于辨识每个图形中的空白四连块的数量。就是UVA 572 - Oil Deposits (油田) By SuCicada的升级版。 好就好在每个图形的白块数量不同,然而如何区分图形内的空白和图形外的空白是个问题。所以我在一开始就把外面的空白都涂黑了。 然后遍历,遍历到文字就将其当作油田求内部连通白块。 (最后的排序是手动实现的插入(:P) /* 1. 16进制 转 2进制 2. 从最外围开始融化 白纸 3. 遍历到文字黑色边缘, 4. 向内遍历找"油田", 即4连块 5. 计算每个文字的4连块数量 6. 结束文字们, 根据4连块数量映射文字, 排序 */ #include<iostream> #include<string> #include<algorithm> #include<cstring> using namespace std; /* 1. 16进制 转 2进制 2. 从最外围开始融化 白纸 3. 遍历到文字黑色边缘, 4. 向内遍历找"油田", 即4连块 5. 计算每个文字的4连块数量 6....
problem class Solution { public int romanToInt(String s) { int N = s.length(); int sum = 0; char a = 0; int b = 0; int c = 0; for(int i=0;i<N;i++){ c = b; a = s.charAt(i); if(a == 'I'){ b = 1; }else if(a == 'V'){ b = 5; }else if(a == 'X'){ b = 10; }else if(a == 'L'){ b = 50; }else if(a == 'C'){ b = 100; }else if(a == 'D'){ b = 500; }else if(a == 'M'){ b = 1000; } // System....
题目 select FirstName, LastName, City, State from Person left join Address using (PersonId); or select FirstName, LastName, City, State from Person left join Address on Person.PersonId=Address.PersonId;
problem select ifnull((select distinct Salary from Employee order by Salary desc limit 1,1), null) as SecondHighestSalary; or other select max(Salary) as SecondHighestSalary from employee where Salary < (select max(Salary) from employee);
problem # 184ms select min(aa.Salary) from (select distinct Salary from employee order by Salary desc limit N) as aa where (select count(distinct Salary) from employee) >= N or # 188ms select aa.Salary as ass from (select distinct Salary from employee order by Salary desc limit N) as aa where (select count(distinct Salary) from employee) >= N order by ass limit 1
problem select inn.Score,inn.Rank from ( select ss.Score,@row:=@row+1 as Rank from (select @row:=0) a, (select Score from Scores group by Score) as ss order by ss.Score desc ) as inn right join Scores as sss on inn.Score = sss.Score order by inn.Score desc ;
这是在Windows10上的Ubuntu WSL环境中遇到的问题。 目前的Ubuntu版本是Ubuntu 20.04.1 LTS。并且使用了阿里的apt镜像源。 先说结论,Ubuntu版本之高使得本机使用apt源中没有所需的库版本。所以可以尝试将apt源换回官方源。然后apt update再安装g++。 以下是断案过程。 在使用命令sudo apt install g++遇到了依赖问题。整个依赖链排查结果如下: sucicada@20200702-143805:/etc/apt/sources.list.d$ sudo apt install g++ Reading package lists... Done Building dependency tree Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: g++ : Depends: g++-7 (>= 7....
在屏幕上显现动态菱形图案。 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * <图一> <图二> <图三> <图四> <图五> 思路示例: <1>编写程序p1: 显示一个字符 <2>把程序p1做成子程序,调用子程序编写程序p2: 显示一个菱形<图三> <3>把p2做成一个子程序,调用子程序编写程序p3: 循环显示出如图五种图形 <4>修改程序p2,实现动态效果: 添加清屏子程序和延时子程序,完成完整程序。 注意点: 要求以统一逻辑实现全部的五个图形。 第三层的公式见代码 assume cs:code code segment start: ; [ input: al: row ] ; [ ah: column ] mov cx,10 start_s: mov di,0 mov si,1 call p3 mov di,4 mov si,-1 call p3 loop start_s mov ax,4c00h int 21h p3: ; -- input: di (index of p2) si (1 or -1) push ax push bx push cx push dx push di ; mov cx,5 ; times ; cmp di,3 ; jne p3_di_not_4 ; p3_di_not_4: mov cx,4 ; times ; mov di,0 p3_s: push cx mov cx,di mov dl,'*' call p2 pop cx ; bx ax lay time mov ax,0 mov bx,1 push cx p3_layout: sub ax,1 sbb bx,0 mov cx,ax or cx,bx cmp cx,0 jne p3_layout pop cx push cx mov cx,di mov dl,' ' call p2 pop cx add di,si loop p3_s pop di pop dx pop cx pop bx pop ax ret p2: push ax push bx push cx ; ----- [1] ----------- mov al,10 mov ah,10 mov bl,al mov bh,ah call p1 add bl,1 ; ----- [2] ----------- push cx cmp cx,0 je p2_2_cx_is_0 sub cx,1 p2_2_cx_is_0: mov al,bl mov ah,bh sub ah,cl call p1 mov ah,bh add ah,cl call p1 pop cx add bl,1 ; ----- [3] ----------- ; left:ah = bh-1-(1+1+(cl-2))*(cl-1)/2 ; = bh-1-cl*(cl-1)/2 = bh-segdis ; right: bh+1+cl*(cl-1)/2 = bh+segdis ; segdis = 1+cl*(cl-1)/2 push cx cmp cx,0 je p2_3_cx_is_0 mov al,cl ; cl sub cl,1 ; cl-1 mul cl ; cl*(cl-1) -> ax mov cl,2 ; 2 div cl ; cl*(cl-1)/2 -> al add al,1 ; cl*(cl-1)/2+1 mov cl,al ; segdis p2_3_cx_is_0: mov al,bl mov ah,bh sub ah,cl ; bh - segdis call p1 mov ah,bh add ah,cl ; bh + segdis call p1 pop cx add bl,1 ; ----- [4] ----------- push cx cmp cx,0 je p2_4_cx_is_0 sub cx,1 p2_4_cx_is_0: mov al,bl mov ah,bh sub ah,cl call p1 mov ah,bh add ah,cl call p1 pop cx add bl,1 ; ----- [5] ----------- mov al,bl mov ah,bh call p1 pop cx pop bx pop ax ret p1: ; ----- input: al: row ah: column dl:char push ax push bx push es mov bx,0b800h mov es,bx mov bl,ah mov bh,al mov al,160 mul bh add bl,bl mov bh,0 add ax,bx mov bx,ax mov byte ptr es:[bx],dl mov byte ptr es:[bx+1],2 pop es pop bx pop ax ret code ends end start ; -------*------- 7 ; -------*------- 7 7 ; -------*------- 7 7 ; -------*------- ; -------*------- ; -------*------- 7 ; -------*------- 7 7 ; ------*-*------ 6 8 ; -------*------- ; -------*------- ; 7-1-(1+1+(n-2))*(n-1)/2 ; 2 ; -------*------- 7 ; ------*-*------ 6 8 ; -----*---*----- 5 9 ; ------*-*------ ; -------*------- ; 3 ; -------*------- 7 ; -----*---*----- 5 9 ; ---*-------*--- 3 11 ; -----*---*----- ; -------*------- ; -------*------- 7 ; ----*-----*---- 4 10 ; *-------------* 0 14 ; ----*-----*---- ; -------*-------
assume cs:code code segment mov ax,20h mov ds,ax mov cx,8 s: mov dx,cx mov bx,cx sub bx,1 ; -------------------- mov cx,9 sub cx,dx ; mov cx,bx add cx,cx sub cx,1 j: mov al,'a' mov [bx],al inc bx loop j ; mov cx,dx ; add bx,10h mov ax,ds add ax,1 mov ds,ax ; mov bx,cx loop s mov ax,4c00h int 21h code ends end 。。。。
assume cs:code code segment ; This code is used to clear the memory ; of the safe area from 0020:0 to 0020:ff mov ax,20 mov ds,ax mov cx,0ffh mov bx,0 s: mov ax,0 mov ds:[bx],ax inc bx loop s mov ax,4c00h int 21h code ends end
@echo off echo code: %1 echo masm..... masm %1; echo link....... link %1; del %1.obj echo delete %1.obj echo finish 起个名 比如 run.bat 放到环境变量下,很方便
如果直接使用书上的代码, 会发现输入一定字符就会卡死 先上代码, 或者跳到问题 assume cs:code ; dsstack segment ; db 16 dup(0) ; dsstack ends code segment start: ; mov ax,dsstack ; mov ds,ax ; mov si,13 ; mov sp,160 call getstr mov ax,4c00h int 21h getstr: push ax getstrs: mov ah,0 int 16h cmp al,20h jb nochar mov ah,0 call charstack mov ah,2 call charstack jmp getstrs nochar: cmp ah,0eh je backspace cmp ah,1ch je enter jmp getstrs backspace: mov ah,1 call charstack mov ah,2 call charstack jmp getstrs enter: mov al,0 mov ah,0 call charstack mov ah,2 call charstack pop ax ret ; ================================== charstack: jmp short charstart table dw charpush,charpop,charshow top dw 0 ; top of stack charstart: push bx push dx push di push es cmp ah,2 ja charret mov bl,ah mov bh,0 add bx,bx jmp word ptr table[bx] charpush: mov bx,top mov ds:[si][bx],al add top,1 jmp charret charpop: cmp top,0 je charret dec top mov bx,top mov al,[si][bx] jmp charret charshow: mov bx,0b800h mov es,bx mov al,160 mov ah,0 mul dh mov di,ax add dl,dl mov dh,0 add di,dx mov bx,0 charshows: cmp bx,top jne noempty mov byte ptr es:[di],'+' ; 结束符 jmp charret noempty: mov al,[si][bx] mov es:[di],al mov byte ptr es:[di+2],'+' ; 结束符 inc bx add di,2 jmp charshows charret: pop es pop di pop dx pop bx ret code ends end start 问题 问题现象:...
APG——Algorithm PlayGround 项目地址 一个有趣,智能和简单的HTML5游戏框架 简单的开发方式,将你的算法变成游戏 对PhaserCE库的封装开发 70+个函数接口可供使用,通过配置文件智能优化游戏 提供可视化的地图编辑方案 官网 官网(备用) Demo 演示 git page(可能会慢) 国内使用 使用在线地图编辑器 APG MapEditor 下载 APG.js MapEditor 使用在线库 github直连 https://sucicada.github.io/Algorithm-PlayGround/dist/APG.js 国内使用(更快) http://sucicada.tk:39/APG/dist/APG.js 最后 十分感谢 @llwwdbd, @lesen-bee 在开发期间所提供的帮助
如果ax中的数是奇数:bx为0 否则bx为1 ; judge which the number in ax is odd or even assume cs:code code segment mov ax,[bx] mov cx,ax mov bx,0 s: loop i ; if can't loop , cx is 1 ; every loop, cx -= 2 ; odd mov bx,0 loop k i: ; sub cx,1 loop s ; even mov bx,1 ; loop k k: ;over mov ax,4c00h int 21h code ends end
参考这个 在使用加环境变量无果 环境 ubuntu 16 atom 1.4 执行以下命令 sudo mkdir -p /.Trash-1000/{expunged,files,info} sudo chown -R $USER /.Trash-1000
参考于cin、cin.get()、cin.getline()、getline()、gets()等函数的用法 cin» (1) » 是会过滤掉不可见字符(如 空格 回车,TAB 等) cin.get() (1) cin.get(char);//接受一个字符 (2) cin.get(char*,接收字符数目);//可以接收空格,接收数目=实际接收字符+1个’\0' cin.getline() (1) cin.getline(char*,接收数目); //可以接收空格,接收数目=实际接收字符+1个’\0' (2) cin.getline(char*,接收数目,结束字符) //当第三个参数省略时,系统默认为’\0’ //cin.getline(str,5,‘a’);当输入abcdef时输出abcd,输入jkaljkljkl时,输出jk #include<string> 1.getline(cin,string str);//可以接收空格 2.gets(char *str);//可以接收空格 3.getchar()//getchar()是C语言的函数,C++也可以兼容,但是尽量不用或少用;