摘要: 转义字符 字符串运算符 注意:字符串只能和字符串进行相加操作 阅读全文
posted @ 2022-05-16 13:42 孤舟浮岸 阅读(22) 评论(0) 推荐(0) 编辑
摘要: python 中的没有 i++ ,如果写了会报语法错误。 但是python 中有 --i,++i,+-i,-+i,他们不是实现-1操作的,仅仅是作为判断运算符号,类似数学中的负负得正 i = 2 print ++i //2 print -+i //-2 print +-i //-2 print -- 阅读全文
posted @ 2022-05-16 13:35 孤舟浮岸 阅读(838) 评论(0) 推荐(0) 编辑
摘要: 运算符// “ // ” 表示整数除法,返回整数 比如 7/3 结果为2 “ / ” 表示浮点数除法,返回浮点数 (即小数) 比如 8/2 结果为4.0 a = 11 // 3 print(a, type(a)) b = 11.0 // 3 # 数轴上的向左取整 print(b, type(b)) 阅读全文
posted @ 2022-05-16 13:21 孤舟浮岸 阅读(1491) 评论(0) 推荐(0) 编辑
摘要: 浮点数运算存在不确定尾数,有误差。可以用round()函数解决这个问题。 round()函数 round(x,n)方法将返回x的值,该值四舍五入到小数点后的n位数字。 当参数n不存在时,round()函数的输出为整数。 当参数n存在时,即使为0,round()函数的输出也会是一个浮点数。 此外,n的 阅读全文
posted @ 2022-05-16 13:13 孤舟浮岸 阅读(1175) 评论(0) 推荐(0) 编辑
摘要: https://www.icourse163.org/learn/ZJU-1206456840 https://pintia.cn/problem-sets/1493440937782476800/problems/1493441031005814790 Python程序设计第一章(MOOC) 7- 阅读全文
posted @ 2022-05-16 12:53 孤舟浮岸 阅读(1212) 评论(0) 推荐(0) 编辑
摘要: https://www.icourse163.org/learn/ZJU-1206456840 https://pintia.cn/problem-sets/1493440937782476800/problems/1493441031005814786 Python程序设计第一章(MOOC) 7- 阅读全文
posted @ 2022-05-16 12:44 孤舟浮岸 阅读(1077) 评论(0) 推荐(0) 编辑
摘要: 原码反码补码在线工具 https://www.23bei.com/tool/56.html 在线进制转换器: https://c.runoob.com/front-end/58/ 在线UTF-8编码转换: http://www.esjson.com/utf8Encode.html 16进制转32位有 阅读全文
posted @ 2022-05-16 12:38 孤舟浮岸 阅读(2315) 评论(0) 推荐(0) 编辑
摘要: print()输出是默认换行的,可以加属性end使其不换行输出。 代码示例 for i in range(5): print(i) for i in range(5): print(i,end='') 控制台输出 0 1 2 3 4 01234 进程已结束,退出代码0 阅读全文
posted @ 2022-05-16 12:24 孤舟浮岸 阅读(366) 评论(0) 推荐(0) 编辑
摘要: input()的类型是str 代码示例 # 输入的都是字符串 a = input("请输入123:") print(a, type(a)) # 可以分割输入 a, b = input("请输入12 34:").split() print(a, type(a)) print(b, type(b)) # 阅读全文
posted @ 2022-05-16 12:21 孤舟浮岸 阅读(595) 评论(0) 推荐(0) 编辑
摘要: gcd,即Greatest Common Divisor的缩写,意为最大公约数 示例 import math num = math.gcd(12,8) print(num) 控制台输出 4 进程已结束,退出代码0 阅读全文
posted @ 2022-05-16 11:50 孤舟浮岸 阅读(443) 评论(0) 推荐(0) 编辑
摘要: https://leetcode.cn/problems/valid-palindrome/submissions/ 提交代码 思路:对撞指针 int toChar(char ch){ if(ch>='0'&&ch<='9'){ return ch; }else if(ch>='A'&&ch<='Z 阅读全文
posted @ 2022-05-15 23:14 孤舟浮岸 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 问题描述 在DEV C++中使用Tab键,虽然在这个IDE中看上去是代码对齐了,但是复制粘贴到其他地方时代码总是不对齐的。 解决办法 修改DEV C++的配置 工具 -- 编辑器选项 编辑器属性 -- 基本 -- 标签 -- 使用Tab字符,取消选择 这样的话,在DEV C++中使用Tab键,就不是 阅读全文
posted @ 2022-05-15 22:32 孤舟浮岸 阅读(258) 评论(0) 推荐(0) 编辑
摘要: https://www.nowcoder.com/exam/oj/ta?tpId=37 https://www.nowcoder.com/practice/253986e66d114d378ae8de2e6c4577c1 提交代码 #include <stdio.h> int main(void){ 阅读全文
posted @ 2022-05-15 21:55 孤舟浮岸 阅读(157) 评论(0) 推荐(0) 编辑
摘要: https://www.nowcoder.com/exam/oj/ta?tpId=37 https://www.nowcoder.com/practice/de044e89123f4a7482bd2b214a685201 提交代码 #include <stdio.h> typedef struct 阅读全文
posted @ 2022-05-15 19:38 孤舟浮岸 阅读(193) 评论(0) 推荐(0) 编辑
摘要: https://www.nowcoder.com/exam/oj/ta?tpId=37 https://www.nowcoder.com/practice/3ab09737afb645cc82c35d56a5ce802a 提交代码 #include <stdio.h> int main(){ flo 阅读全文
posted @ 2022-05-15 18:24 孤舟浮岸 阅读(138) 评论(0) 推荐(0) 编辑
摘要: https://www.nowcoder.com/exam/oj/ta?tpId=37 https://www.nowcoder.com/practice/196534628ca6490ebce2e336b47b3607 提交代码 #include <stdio.h> int main() { in 阅读全文
posted @ 2022-05-15 18:05 孤舟浮岸 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 这是我的牛客博客 https://blog.nowcoder.net/tsuish 阅读全文
posted @ 2022-05-15 17:37 孤舟浮岸 阅读(21) 评论(0) 推荐(0) 编辑
摘要: https://www.nowcoder.com/exam/oj/ta?tpId=37 https://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6 提交代码 #include <stdio.h> int main() { ch 阅读全文
posted @ 2022-05-15 17:29 孤舟浮岸 阅读(143) 评论(0) 推荐(0) 编辑
摘要: https://www.nowcoder.com/exam/oj/ta?tpId=37 https://www.nowcoder.com/practice/d9162298cb5a437aad722fccccaae8a7 提交代码 #include <stdio.h> int main() { ch 阅读全文
posted @ 2022-05-15 17:04 孤舟浮岸 阅读(188) 评论(0) 推荐(0) 编辑
摘要: https://www.nowcoder.com/exam/oj/ta?tpId=37 https://www.nowcoder.com/practice/3245215fffb84b7b81285493eae92ff0 提交代码 #include <stdio.h> int main() { in 阅读全文
posted @ 2022-05-15 16:46 孤舟浮岸 阅读(76) 评论(0) 推荐(0) 编辑