这是sql server的第七、八次上机内容,抽了几天时间给做了

在原有的booksDB库中加了一个Admin表:UserName:root,PassWord:123456.

环境:Visual Studio 2010,SQL Server 2008

参考书籍:

项目结构:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Threading; namespace WindowsFormsApplication2
{
public partial class Login : Form
{
public Login()
{
InitializeComponent();
} private void label1_Click(object sender, EventArgs e)
{ } private void textBox2_TextChanged(object sender, EventArgs e)
{ } private void label1_Click_1(object sender, EventArgs e)
{ } private void button1_Click(object sender, EventArgs e)
{
string User = UserName.Text;
string Pwd = PassWord.Text;
SqlConnection conn = new SqlConnection();
conn.ConnectionString = "server=.;database=booksDB;integrated security=True";
try
{
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "select * from Admin where UserName='" + User + "'";
SqlDataReader reader = comm.ExecuteReader();
if (reader.Read())
{
string password = reader.GetString(reader.GetOrdinal("PassWord"));
if (Pwd == password)
{
MessageBox.Show("登陆成功!");
new Thread(() => Application.Run(new Menu())).Start();
this.Close();
//this.Hide();
//Form M = new Management();
//M.Show();
}
else
{
MessageBox.Show("密码错误!");
UserName.Text = " ";
PassWord.Text = " ";
}
}
else
{
MessageBox.Show("用户不存在!");
UserName.Text = " ";
PassWord.Text = " ";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "操作数据库出错");
}
finally
{
conn.Close();
}
}
}
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms; namespace WindowsFormsApplication2
{
public partial class Menu : Form
{
public Menu()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
this.Hide();
new ReaderTypeM().Show();
} private void button2_Click(object sender, EventArgs e)
{
this.Hide();
new BookM().Show();
} private void button3_Click(object sender, EventArgs e)
{
this.Hide();
new ReaderM().Show();
} private void button4_Click(object sender, EventArgs e)
{
this.Hide();
new BorrowAndReturn().Show();
} private void Menu_Load(object sender, EventArgs e)
{ } private void Out_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

连数据库前先用BindingSource控件绑定数据库数据。再用DataGridView控件展示数据。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient; namespace WindowsFormsApplication2
{
public partial class ReaderTypeM : Form
{
public ReaderTypeM()
{
InitializeComponent();
} private void BackMenu_Click(object sender, EventArgs e)
{
this.Hide();
new Menu().Show();
} private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{ } private void Add_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("server=.;database=booksDB;integrated security=True");
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "insert into ReaderType values(@rdType,@rdTypeName,@canLendQty,@canLendDay)";
comm.Parameters.AddWithValue("@rdType", txtrdType.Text);
comm.Parameters.AddWithValue("@rdTypeName", txtrdTypeName.Text);
comm.Parameters.AddWithValue("@canLendQty", txtcanLendQty.Text);
comm.Parameters.AddWithValue("@canLendDay", txtcanLendDay.Text);
try
{
comm.ExecuteNonQuery();
MessageBox.Show("插入成功!");
DataBind();
}
catch (Exception ex)
{ MessageBox.Show("插入失败!" + ex.Message);
}
} private void Search_Click(object sender, EventArgs e)
{
DataBind();
}
private void Delete_Click(object sender, EventArgs e)
{
MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
DialogResult dr = MessageBox.Show("确定要删除吗?", "确定", messButton);
if (dr == DialogResult.OK)
{
SqlConnection conn = new SqlConnection("server=.;database=booksDB;integrated security=True");
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "delete from ReaderType where rdType = @rdType";
comm.Parameters.AddWithValue("@rdType", txtrdType.Text);
try
{
comm.ExecuteNonQuery();
MessageBox.Show("删除成功!");
DataBind();
}
catch (Exception ex)
{ MessageBox.Show("删除失败!" + ex.Message);
}
}
} private void Alter_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("server=.;database=booksDB;integrated security=True");
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "update ReaderType set rdType=@rdType,rdTypeName=@rdTypeName,canLendQty=@canLendQty,canLendDay=@canLendDay where rdType=@rdType";
comm.Parameters.AddWithValue("@rdType", txtrdType.Text);
comm.Parameters.AddWithValue("@rdTypeName", txtrdTypeName.Text);
comm.Parameters.AddWithValue("@canLendQty", txtcanLendQty.Text);
comm.Parameters.AddWithValue("@canLendDay", txtcanLendDay.Text);
try
{
comm.ExecuteNonQuery();
MessageBox.Show("更新成功!");
DataBind();
}
catch (Exception ex)
{ MessageBox.Show("更新失败!" + ex.Message);
}
}
private void DataBind()
{
SqlConnection conn = new SqlConnection("server=.;database=booksDB;integrated security=True");
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "select rdType 类别号,rdTypeName 类别名称,canLendQty 可借数量,canLendDay 可借天数 from ReaderType";
SqlDataAdapter sda = new SqlDataAdapter(comm);
DataSet ds = new DataSet();
sda.Fill(ds);
dgvBook.DataSource = ds.Tables[]; txtrdType.DataBindings.Clear();
txtrdTypeName.DataBindings.Clear();
txtcanLendQty.DataBindings.Clear();
txtcanLendDay.DataBindings.Clear(); txtrdType.DataBindings.Add("Text", ds.Tables[], "类别号");
txtrdTypeName.DataBindings.Add("Text", ds.Tables[], "类别名称");
txtcanLendQty.DataBindings.Add("Text", ds.Tables[], "可借数量");
txtcanLendDay.DataBindings.Add("Text", ds.Tables[], "可借天数");
conn.Close();
} private void ReaderTypeM_Load(object sender, EventArgs e)
{
DataBind();
} private void bindingSource1_CurrentChanged(object sender, EventArgs e)
{ } }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient; namespace WindowsFormsApplication2
{
public partial class BookM : Form
{
public BookM()
{
InitializeComponent();
} private void bindingSource1_CurrentChanged(object sender, EventArgs e)
{ } private void BackMenu_Click(object sender, EventArgs e)
{
this.Hide();
new Menu().Show();
} private void Add_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("server=.;database=booksDB;integrated security=True");
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "insert into Book values(@bkID,@bkName,@bkAuthor,@bkPress,@bkPrice,@bkStatus)";
comm.Parameters.AddWithValue("@bkID", txtbkID.Text);
comm.Parameters.AddWithValue("@bkName", txtbkName.Text);
comm.Parameters.AddWithValue("@bkAuthor", txtbkAuthor.Text);
comm.Parameters.AddWithValue("@bkPress", txtbkPress.Text);
comm.Parameters.AddWithValue("@bkPrice", txtbkPrice.Text);
comm.Parameters.AddWithValue("@bkStatus", txtbkStatus.Text);
try
{
comm.ExecuteNonQuery();
MessageBox.Show("插入成功!");
DataBind();
}
catch (Exception ex)
{ MessageBox.Show("插入失败!" + ex.Message);
}
} private void Search_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("server=.;database=booksDB;integrated security=True");
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "select bkID 书号,bkName 书名,bkAuthor 作者,bkPress 出版社,bkPrice 单价,bkStatus 状态 from Book where bkName like + @bkName + '%' ";
comm.Parameters.AddWithValue("@bkName", txtbkName.Text);
SqlDataAdapter sda = new SqlDataAdapter(comm);
DataSet ds = new DataSet();
sda.Fill(ds);
dgvBook.DataSource = ds.Tables[];
} private void Delete_Click(object sender, EventArgs e)
{
MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
DialogResult dr = MessageBox.Show("确定要删除吗?", "确定", messButton);
if (dr == DialogResult.OK)
{
SqlConnection conn = new SqlConnection("server=.;database=booksDB;integrated security=True");
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "delete from Book where bkID = @bkID";
comm.Parameters.AddWithValue("@bkID", txtbkID.Text);
try
{
comm.ExecuteNonQuery();
MessageBox.Show("删除成功!");
DataBind();
}
catch (Exception ex)
{ MessageBox.Show("删除失败!" + ex.Message);
}
}
} private void Alter_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("server=.;database=booksDB;integrated security=True");
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "update Book set bkID=@bkID,bkName=@bkName,bkAuthor=@bkAuthor,bkPress=@bkPress,bkPrice=@bkPrice,bkStatus=@bkStatus where bkID=@bkID";
comm.Parameters.AddWithValue("@bkID", txtbkID.Text);
comm.Parameters.AddWithValue("@bkName", txtbkName.Text);
comm.Parameters.AddWithValue("@bkAuthor", txtbkAuthor.Text);
comm.Parameters.AddWithValue("@bkPress", txtbkPress.Text);
comm.Parameters.AddWithValue("@bkPrice", txtbkPrice.Text);
comm.Parameters.AddWithValue("@bkStatus", txtbkStatus.Text);
try
{
comm.ExecuteNonQuery();
MessageBox.Show("更新成功!");
DataBind();
}
catch (Exception ex)
{ MessageBox.Show("更新失败!" + ex.Message);
}
} private void DataBind()
{
SqlConnection conn = new SqlConnection("server=.;database=booksDB;integrated security=True");
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "select bkID 书号,bkName 书名,bkAuthor 作者,bkPress 出版社,bkPrice 单价,bkStatus 状态 from Book";
SqlDataAdapter sda = new SqlDataAdapter(comm);
DataSet ds = new DataSet();
sda.Fill(ds);
dgvBook.DataSource = ds.Tables[]; txtbkID.DataBindings.Clear();
txtbkName.DataBindings.Clear();
txtbkAuthor.DataBindings.Clear();
txtbkPress.DataBindings.Clear();
txtbkPrice.DataBindings.Clear();
txtbkStatus.DataBindings.Clear(); txtbkID.DataBindings.Add("Text", ds.Tables[], "书号");
txtbkName.DataBindings.Add("Text", ds.Tables[], "书名");
txtbkAuthor.DataBindings.Add("Text", ds.Tables[], "作者");
txtbkPress.DataBindings.Add("Text", ds.Tables[], "出版社");
txtbkPrice.DataBindings.Add("Text",ds.Tables[],"单价");
txtbkStatus.DataBindings.Add("Text",ds.Tables[],"状态");
conn.Close();
}
private void BookM_Load(object sender, EventArgs e)
{
DataBind();
}
}
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient; namespace WindowsFormsApplication2
{
public partial class ReaderM : Form
{
public ReaderM()
{
InitializeComponent();
} private void BackMenu_Click(object sender, EventArgs e)
{
this.Hide();
new Menu().Show();
} private void Add_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("server=.;database=booksDB;integrated security=True");
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "insert into Reader values(@rdID,@rdType,@rdName,@rdDept,@rdQQ,@rdBorrowQty)";
comm.Parameters.AddWithValue("@rdID", txtrdID.Text);
comm.Parameters.AddWithValue("@rdType", txtrdType.Text);
comm.Parameters.AddWithValue("@rdName", txtrdName.Text);
comm.Parameters.AddWithValue("@rdDept", txtrdDept.Text);
comm.Parameters.AddWithValue("@rdQQ", txtrdQQ.Text);
comm.Parameters.AddWithValue("@rdBorrowQty", txtrdBorrowQty.Text);
try
{
comm.ExecuteNonQuery();
MessageBox.Show("插入成功!");
DataBind();
}
catch (Exception ex)
{ MessageBox.Show("插入失败!" + ex.Message);
}
} private void Search_Click(object sender, EventArgs e)
{
DataBind();
} private void Delete_Click(object sender, EventArgs e)
{
MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
DialogResult dr = MessageBox.Show("确定要删除吗?", "确定", messButton);
if (dr == DialogResult.OK)
{
SqlConnection conn = new SqlConnection("server=.;database=booksDB;integrated security=True");
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "delete from Reader where rdID = @rdID";
comm.Parameters.AddWithValue("@rdID", txtrdID.Text);
try
{
comm.ExecuteNonQuery();
MessageBox.Show("删除成功!");
DataBind();
}
catch (Exception ex)
{ MessageBox.Show("删除失败!" + ex.Message);
}
}
} private void Alter_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("server=.;database=booksDB;integrated security=True");
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "update Reader set rdID=@rdID,rdType=@rdType,rdName=@rdName,rdDept=@rdDept,rdQQ=@rdQQ,rdBorrowQty=@rdBorrowQty where rdID=@rdID";
comm.Parameters.AddWithValue("@rdID", txtrdID.Text);
comm.Parameters.AddWithValue("@rdType", txtrdType .Text);
comm.Parameters.AddWithValue("@rdName", txtrdName.Text);
comm.Parameters.AddWithValue("@rdDept", txtrdDept.Text);
comm.Parameters.AddWithValue("@rdQQ", txtrdQQ.Text);
comm.Parameters.AddWithValue("@rdBorrowQty",txtrdBorrowQty.Text);
try
{
comm.ExecuteNonQuery();
MessageBox.Show("更新成功!");
DataBind();
}
catch (Exception ex)
{ MessageBox.Show("更新失败!" + ex.Message);
}
} private void DataBind()
{
SqlConnection conn = new SqlConnection("server=.;database=booksDB;integrated security=True");
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "select rdID 读者编号,rdType 读者类别号,rdName 读者姓名,rdDept 读者单位,rdQQ 读者QQ,rdBorrowQty 已借书数量 from Reader";
SqlDataAdapter sda = new SqlDataAdapter(comm);
DataSet ds = new DataSet();
sda.Fill(ds);
dgvReader.DataSource = ds.Tables[]; txtrdID.DataBindings.Clear();
txtrdType.DataBindings.Clear();
txtrdName.DataBindings.Clear();
txtrdDept.DataBindings.Clear();
txtrdQQ.DataBindings.Clear();
txtrdBorrowQty.DataBindings.Clear(); txtrdID.DataBindings.Add("Text", ds.Tables[], "读者编号");
txtrdType.DataBindings.Add("Text", ds.Tables[], "读者类别号");
txtrdName.DataBindings.Add("Text", ds.Tables[], "读者姓名");
txtrdDept.DataBindings.Add("Text", ds.Tables[], "读者单位");
txtrdQQ.DataBindings.Add("Text", ds.Tables[], "读者QQ");
txtrdBorrowQty.DataBindings.Add("Text", ds.Tables[], "已借书数量");
conn.Close();
}
private void ReaderM_Load(object sender, EventArgs e)
{
DataBind();
} }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient; namespace WindowsFormsApplication2
{
public partial class BorrowAndReturn : Form
{
public BorrowAndReturn()
{
InitializeComponent();
} private void BorrowBook_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("server=.;database=booksDB;integrated security=True");
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "exec usp_BorrowBook @rdID,@bkID";
comm.Parameters.AddWithValue("@rdID", txtrdID.Text);
comm.Parameters.AddWithValue("@bkID", txtbkID.Text);
try
{
comm.ExecuteNonQuery();
MessageBox.Show("借书成功!");
}
catch (Exception ex)
{ MessageBox.Show("借书失败!" + ex.Message);
}
} private void ReturnBook_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("server=.;database=booksDB;integrated security=True");
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "exec usp_ReturnBook @rdID,@bkID";
comm.Parameters.AddWithValue("@rdID", txtrdID.Text);
comm.Parameters.AddWithValue("@bkID", txtbkID.Text); try
{
comm.ExecuteNonQuery();
MessageBox.Show("还书成功!");
}
catch (Exception ex)
{ MessageBox.Show("还书失败!" + ex.Message);
}
} private void BorrowAndReturn_Load(object sender, EventArgs e)
{ } private void BackMenu_Click(object sender, EventArgs e)
{
this.Hide();
new Menu().Show();
} private void Borrow_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("server=.;database=booksDB;integrated security=True");
conn.Open();
SqlCommand comm = conn.CreateCommand();
comm.CommandText = "select rdID 读者编号,bkID 书号,DateBorrow 借书日期,DateLendPlan 应还日期,DateLendAct 实际还书日期 from Borrow";
SqlDataAdapter sda = new SqlDataAdapter(comm);
DataSet ds = new DataSet();
sda.Fill(ds);
dgvBorrow.DataSource = ds.Tables[];
conn.Close();
} }
}

源码地址:https://github.com/Vito-Yan/iCourse

学院派福利——C#+SQL Server图书管理系统的更多相关文章

  1. JAVA图书管理系统汇总共27个

    好多人都在搜索图书管理系统,感觉这个挺受欢迎的,所以整理了一系列的图书管理系统,让大家选择.java图书馆管理系统[优秀毕业设计论文+源码]http://down.51cto.com/data/683 ...

  2. JAVA图书管理系统汇总共27个[转]

    java图书馆管理系统[优秀毕业设计论文+源码]http://down.51cto.com/data/68350java+sql server图书管理系统 http://down.51cto.com/ ...

  3. Sql Server之数据类型详解

      数据类型是一种属性,用于指定对象可保存的数据的类型,SQL Server中支持多种数据类型,包括字符类型.数值类型以及日期类型等.数据类型相当于一个容器,容器的大小决定了装的东西的多少,将数据分为 ...

  4. SQL Server 数据库的安全管理(登录、角色、权限)

    ---数据库的安全管理 --登录:SQL Server数据库服务器登录的身份验证模式:1)Windows身份验证.2)Windows和SQL Server混合验证 --角色:分类:1)服务器角色.服务 ...

  5. php连接sql server

    这两天有个php连接sql server的项目,顺便学习学习sql server  说明: 1:PHP5.2.x本身有个php_mssql.dll的扩展用来连接Sql server,但是这个dll只是 ...

  6. Sql Server 常用系统存储过程大全

    -- 来源于网络 -- 更详细的介结参考联机帮助文档 xp_cmdshell --*执行DOS各种命令,结果以文本行返回. xp_fixeddrives --*查询各磁盘/分区可用空间 xp_logi ...

  7. sql server 常用的系统存储过程

      系统存储过程 说明 sp_databases 列出服务上的所有数据库 sp_helpdb 报告有关指定数据库或所有数据库的信息 sp_renamedb 更改数据库的名称 sp_tables 返回当 ...

  8. sql server系统存储过程大全

    关键词:sql server系统存储过程,mssql系统存储过程 xp_cmdshell --*执行DOS各种命令,结果以文本行返回. xp_fixeddrives --*查询各磁盘/分区可用空间 x ...

  9. 十大监视SQL Server性能的计数器

      作为DBA,每个人都会用一系列计数器来监视SQLSERVER的运行环境,使用计数器,既可以衡量当前的数据库的性能,还可以和以前的性能进行对比.我们也可以一直以快速和简单的方法把计数器做了一张图表来 ...

随机推荐

  1. BZOJ 4833: [Lydsy1704月赛]最小公倍佩尔数(数论 + 最值反演)

    题面 令 \({(1+\sqrt 2)}^n=e(n)+f(n)*\sqrt2\) ,其中 \(e(n),f(n)\) 都是整数,显然有 \({(1-\sqrt 2)}^n=e(n)-f(n)*\sq ...

  2. ALLOT流控设备Qos解读

    ALLOT流控设备Qos解读  1. QOS 服务质量引擎 对于基于用户定义,QoS引擎根据用户定义进行决策,每个帧是否要: 传输数据帧到网络: 将数据帧存储在缓冲区: 丢掉数据帧. 新AOS改进了Q ...

  3. 【BZOJ4061】[Cerc2012]Farm and factory(最短路,构造)

    [BZOJ4061][Cerc2012]Farm and factory(最短路,构造) 题面 BZOJ 然而权限题QwQ. 题解 先求出所有点到达\(1,2\)的最短路,不妨记为\(d_{u,1}, ...

  4. [HNOI2015]菜肴制作(拓扑排序)

    知名美食家小 A被邀请至ATM 大酒店,为其品评菜肴. ATM 酒店为小 A 准备了 N 道菜肴,酒店按照为菜肴预估的质量从高到低给予1到N的顺序编号,预估质量最高的菜肴编号为1. 由于菜肴之间口味搭 ...

  5. Spring乱码问题解决方案

    请求乱码 GET请求乱码: 原因:请求参数带在url地址上.url地址什么时候解析? tomcat收到请求对url进行编解码(ISO8859-1) 解决方案:在tomcat的8080端口配置出加上 U ...

  6. MyBatis深入浅出--入门

    mybatis概述 mybatis简介 MyBatis 是支持定制化 SQL.存储过程以及高级映射的优秀的持久层框架. MyBatis 避免了几乎所有的 JDBC 代码和手动设置参数以及获取结果集. ...

  7. kafaka quickstart

    http://kafka.apache.org/ http://kafka.apache.org/downloads cd /root/kafuka/kafka_2.12-0.11.0.0 nohup ...

  8. QML学习笔记(三)-引入Font-awesome

    作者: 狐狸家的鱼 Github: 八至 1.首先得在qml文件夹下建立字体文件,将font-awesome放入进去 2.然后在main.cpp中注册字体 引入中一定要写上 引用字体 引用字体得路径一 ...

  9. [CTSC2018]暴力写挂——边分树合并

    [CTSC2018]暴力写挂 题面不错 给定两棵树,两点“距离”定义为:二者深度相加,减去两棵树上的LCA的深度(深度指到根节点的距离) 求最大的距离. 解决多棵树的问题就是降维了. 经典的做法是边分 ...

  10. poj2559 Largest Rectangle in a Histogram

    洛谷上做过一道一样的题(P1719 最大加权矩形),但是没写博客... 现在已一个新高度来看待这题,沿用以前的方法,感觉很好(草稿纸模拟数小时后20分钟AC) 就是对于每一个位置,记录能够往右延伸多远 ...