现在位置: 首页 > xiashili发表的所有文章
  • 08月
  • 18日
综合 ⁄ 共 2286字 评论关闭
题目链接:uva 1385 - Billing Tables 题目大意:给定n个电话前缀,每个前缀是一个区域的前缀,现在要生成一个新的电话单,即对于每个电话号码,从旧的电话单上从前向后遍历,如果出现前缀匹配,则该电话号码对应的即为当前的区号,要求生成的新电话单尽量小。 解题思路:用dfs建立字典树,在区间范围内的点对应均为对应的区号,注意如果70、71、72、...79都为SB的话,那么可以合并成7,并且对应区号为SB。 注意合并的条件为区号相同即可,并不是说对应旧电话单匹配位置相同。 注意这组数据:0 - 9 all #include <cstdio>......
阅读全文
  • 05月
  • 24日
综合 ⁄ 共 1345字 评论关闭
以前看示例代码的时候,经常看到jsp文件中出现诸如 ${...}一类的代码,一直困惑,今天看到了这一节的内容,也算有了个系统的学习,书上讲的很明白,也很简洁。 1.EL表达式的语法格式很简单: 以前编写jsp代码时,如果要获取表单中的用户名,一般使用  <%=request.getParameter("name")%> ,这样当然也可以获取到值,但是又把html代码和java代码混到一起,看起来比较乱套。现在使用EL表达式的话就比较简洁了:${param.name} 就可以解决了。 注意:${表达式} 表达式部分不需要加引号,如果写成 ${"param.name"} ,那么页面......
阅读全文
  • 02月
  • 16日
算法 ⁄ 共 2166字 评论关闭
One Person Game Time Limit: 1 Second      Memory Limit: 32768 KB      Special Judge There is a very simple and interesting one-person game. You have 3 dice, namelyDie1, Die2 and Die3. Die1 hasK1 faces. Die2has K2 faces.Die3 has K3 faces. All the dice are fair dice, so the probability of rolling each value, 1 toK1, K2, K3is exactly 1 /K1, 1 / K2 and 1 / K3.You have a counter, and the game is played as follow: Set the counter to 0 at first. Roll the 3 dice simultaneously. If the up-fac......
阅读全文
  • 01月
  • 07日
综合 ⁄ 共 1685字 评论关闭
转载请注明,来自:http://blog.csdn.net/skyman_2001 class Component { public: Component() {} virtual ~Component() {} virtual void operation() = 0; virtual Component *remove() = 0; }; class ConcreteComponent: public Component { public: ConcreteComponent() {} ~ConcreteComponent() {} void operation() { std::cout <<"Concrete component operation"<< std::endl; } Component *remove() { return this; } }; class Decorator : public Component { public: Decorator(Compon......
阅读全文
// // // // // // // // // ///2013.3.6 // // // // // // // // // 终于走到了设计模式的最后一个。 平心而论, 之前的22个设计模式大多都是比较常见的, 几乎做任何项目都有使用的价值。 然而这个Interpreter模式则不然, 其适用范围较小。 正如其名, 此模式大多用来解释一些(自定义的)独特语法, 例如某些游戏开发引擎中读取XML文件, 或是WindowsPhone开发中的XAML文件, 都是使用此模式来进行的。 与其说是一种模式, 不如说是一种具有通用规范的行为更为准确。 其简单的一个例子是: 斯摩格......
阅读全文
  • 07月
  • 14日
综合 ⁄ 共 181字 评论关闭
-(void) getDns { res_init(); for (int i=0;i<MAXNS;i++) { printf("%s",inet_ntoa(_res.nsaddr_list[i].sin_addr)); } } 来自:http://stackoverflow.com/questions/5325401/getting-dns-server-ip-on-iphone
阅读全文
  • 06月
  • 08日
综合 ⁄ 共 973字 评论关闭
JavaMail API是sun公司为方便Java开发人员在应用程序中时间邮件发送和接收功能而提供的一套标准开发包,它支持一些常用的邮件协议,如SMTP、POP3、IMAP和MIME等。JavaMail中的核心的API类有Message、Transport、Store和Session四个类。 Message类是创建和解析邮件的核心API,它的实例对象代表一封电子邮件。 Transport类是发送邮件的核心API类,它的实例对象代表实现了某个邮件发送协议的邮件发送对象。 Store类是接受邮件的核心API,它的实例对象代表了某一个邮件接收协议的邮件接收对象 Session类定义了整个应用程序所需要的环境......
阅读全文
  • 06月
  • 07日
综合 ⁄ 共 691字 评论关闭
1、写出常用的设计模式,如单例、工厂、装饰者、观察者等模式,分别介绍他们运用的场景 2、关于标准的JDK库中使用的一些设计模式 Decorator设计模式常被用于各种Java IO类中 Singleton模式常被用在运行环节中,Calendar以及各种其他类 Factory(工厂)模式常被用于各种不可变类,比如Boolean。Boolean.valueOf Observer模式常被用于Swing和许多事件监听器框架中。 3. 在Java中Singleton设计模式是什么?为线程安全Singleton编码。 Singleton模式在整个系统中主要是共享模式。在整个应用程序实例中只保持一个特定的类,这是由所......
阅读全文
  • 05月
  • 27日
综合 ⁄ 共 1068字 评论关闭
Points within the perspective (or orthographic) frustum are transformed by the projection matrix to the (homogeneous) space that is contained within a cube centered at the origin, with side length of 2. This space is called the canonical viewing volume. The term "homogeneous" means that these coordinates should not necessarily be considered to be true Cartesian positions until they are divided by their fourth coordinate. The x and y components of the position in clip coordinates are roug......
阅读全文
  • 05月
  • 06日
综合 ⁄ 共 1304字 评论关闭
子父类出现后,类成员的特点:   类中成员: 1、变量 2、函数 3、构造函数   1、变量 如果子类中出现非私有的同名的成员变量时, 子类要访问本类中的变量,用this关键字 子类要访问父类中的同名变量,用super关键字   super和this的使用几乎一致 this代表的是本类对象的引用 super代表的是父类对象的引用   如果子类和父类有相同名称的变量时,子类继承父类后,在子类中默认使用的是自己的变量, 因为在子类中是this.num省略了this。如果要用父类的变量只需要在变量前加上super   2、函数 当子类出现和父类一......
阅读全文
import resources.Crerate_DMInstanceHelper;import com.rational.test.ft.*;import com.rational.test.ft.object.interfaces.*;import com.rational.test.ft.object.interfaces.SAP.*;import com.rational.test.ft.object.interfaces.WPF.*;import com.rational.test.ft.object.interfaces.dojo.*;import com.rational.test.ft.object.interfaces.siebel.*;import com.rational.test.ft.object.interfaces.flex.*;import com.rational.test.ft.script.*;import com.rational.test.ft.value.*;import com.rational.test.ft.vp.*; /......
阅读全文
  • 04月
  • 25日
综合 ⁄ 共 437字 评论关闭
http://acm.timus.ru/problem.aspx?space=1&num=1022 #include<iostream> #include<cstdio> using namespace std; int n,r[101],c[101],a[101][101],ans[101],tot,t; int main(){ scanf("%d",&n); for(int i=1;i<=n;i++){ while(1){ scanf("%d",&t); if(t==0)break; r[t]++;c[i]++; a[i][c[i]]=t; } } for(int i=1;i<=n;i++) if(!r[i])ans[++tot]=i; for(int i=1;i<=n;i++){ t=ans[tot];tot--; printf("%d ",t); for(int j=1;j<=c[t];j++){ r[a[t][j]]--; ......
阅读全文