随笔分类 - 语言
摘要:在某程序中访问文件时出现错误,遂拿2个文件实验一下 实验: 环境 Windows 11 VS 2022 .NET 7.0 在 TMP 目录下有两个文件:1 2 1 是我手动创建的一个文本文件,写入 111 2 是从微信上下载下来的文件 直接打开并读取文件 1 正常显示: 尝试打开文件 2 时出现错误
阅读全文
摘要:信息获取 官网:http://www.lua.org/ 入门信息:http://www.lua.org/start.html 在入门信息中有几个值得关注的入口点:(红框标记) online: 在线教程 live demo: 在线运行程序 download: 开发环境下载页面 下载 & 安装 点击do
阅读全文
摘要:/* 输入一个正数x和一个正整数n,求下列算式的值。 x - x2/2! + x3/3! + ... + (-1)n-1xn/n! 要求定义两个调用函数:fact(n)计算n的阶乘 mypow(x,n)计算x的n次幂(即x^n),两个函数的返回值类型是double。(×输出保留4位小数) 计算分析:
阅读全文
摘要:背景 刚才修改了Python目录名,重新添加了环境变量,命令行可以正常执行python。 打开Vim开始编辑文件,发现一输入或刚输入几个字符就闪退了。 解决 重新打开禁用了插件加载,运行正常,逐个开启检查发现Ultisnip开启时,导致这种情况,:PlugStatus (Vim-Plug管理器命令)
阅读全文
摘要:/* 不安全的单例 多线程访问时可能会创建多个对象 */ public sealed class Singleton { private Singleton instance; //将构造函数变为私有,使得外部不可调用 private Singleton() { } public static Si
阅读全文
摘要:在使用多个线程读写同一个变量时,可能会出现与预期不符的情况。 线程的执行顺序每次都可能不一样,因为顺序由操作系统调度顺序决定。 //多线程读写测试函数 private static void MultiThreadsRW() { int i; i = 0; Thread t1 = new Threa
阅读全文
摘要:\begin a+b=3 \end \(b-a=1\) \(a=1,b=2\) \[ a_1+a_2+...+a_n=S_n \] \begin f(n)=1+2+3+...+n \end \begin 1&0\\ 0&1\\ 2&3 \end \\是为了转义两个</i> \begin{bmatri
阅读全文
摘要:/* Consider the following algorithm to generate a sequence of numbers. Start with an integer n. If n is even, divide by 2. If n is odd, multiply by 3
阅读全文
摘要:#include <stdio.h> #define N 6 void input(int *p,int n); void ouput(int *p,int n); int main(){ int a[N]; input(a,N); ouput(a,N); return 0; } void inpu
阅读全文
摘要:Unix时间戳,从1970-1-1 0:0:0 UTC到现在的累计时间:秒数,毫秒数 public static DateTime UnixTimeStampStart = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); DateTime的T
阅读全文
摘要:/* calculate a num y which is base x to exp n 2^n=2*2^n-1 (n is an odd) 2^n=2^(n/2)*2^(n/2) (n is an even) judge method: if:b&1 b%2==1 (b is an odd) else:!(b&1) b%2==0 (b is...
阅读全文
摘要:定义: 完全数:所有的真因子(即除了自身以外的约数)的和,恰好等于它本身。例如:第一个完全数是6,它有约数1、2、3、6,除去它本身6外,其余3个数相加,1+2+3=6。第二个完全数是28,它有约数1、2、4、7、14、28,除去它本身28外约数相加=28。 性质: (1)所有的完全数都是三角数。例
阅读全文

浙公网安备 33010602011771号