今天群里有同学问如何用linq取结果集的行号,查了一下资料,发现linq有很简单的方法可以实现,花了几分钟写了一个测试用例,现记录下来,以备参考: /// <summary> /// 测试类 /// </summary> public class models { public int id { set; get; } public string Name { set; get; } public string Phone { set; get; } public string A
为了防止程序SQL语句错误以及SQL注入,单引号必须经过处理.有2种办法: 1.使用参数,比如SELECT * FROM yourTable WHERE name = @name; 在C#中使用SqlParameter parameter = new SqlParameter("@name", objValue);来添加参数,懒得写SqlDbType这东西了,因为不写也完全可以,只需要参数名和值. 在JAVA中就是用预处理PreparedStatement来添加参数. 2.如果不用参数
下载 clamwin 到 windows 并安装 http://www.clamwin.com/ 为了方便使用clamwin,写一个bat,实现拖拽到bat 自动查毒 @echo off mode con cols= lines= REM 拖拽查毒 REM 文件全名为: %~nx1, 文件名为: %~n1, 扩展名为: %~x1 REM set "suffix=%~x1" set "path=%~dp1" set "filename=%~nx1"
对于某个靴子,如果0代表某个格能走,1代表不能走,那么只要连续的1的个数的最大值>=靴子的步长,那这个靴子就不能用. 那么只要对靴子和格子都按深度排个序,然后从大到小来扫一遍(靴子越来越浅,能走的格子就越来越少,也就是相当于在增加1的个数),现在只要能维护把0变成1后,连续的1个数的最大值就行了 用并查集就可以了(好像双向链表或者线段树也行?). #include<bits/stdc++.h> #define ll long long #define pa pair<int,int
1021 Deepest Root (25)(25 分) A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such a root is called the deepest