public class person { public string name; } public class person { public string Name { set; get; } } 上面的两个类,第一个person存储的是name属性,由于是public属性,可以由其他类访问,第二个person的name属性通过了set.get进行了封装,get.set分别是可读可写.等价于如下代码 public class person { private string name; pub…
class Person//声明一个Person类 { //类中的声明与Main中不同,类中声明的是字段而不是函数. public string gender; public string name="Tom";//在类中只能给字段赋值一行代码 "); } class Program { static void Main(string[] args) { ; Person p1 = new Person();//定义Person类的对象p1 p1.gender = "…
The Doors Time Limit: 1000MS Memory Limit: 10000K Description You are to find the length of the shortest path through a chamber containing obstructing walls. The chamber will always have sides at x = 0, x = 10, y = 0, and y = 10. The initial and fina…
传送门 先假设所有物品都能用,做01背包求出方案数. 然后枚举每个点,分类讨论扣掉它对答案的贡献. 代码: #include<bits/stdc++.h> using namespace std; const int N=2e3+5; int n,m,w[N],f[N],g[N]; inline int read(){ int ans=0; char ch=getchar(); while(!isdigit(ch))ch=getchar(); while(isdigit(ch))ans=(an…