现在位置: 首页 > stang发表的所有文章
  • 02月
  • 16日
综合 ⁄ 共 2439字 评论关闭
Special Subsequence Time Limit: 5 Seconds      Memory Limit: 32768 KB There a sequence S with n integers , and A is a special subsequence thatsatisfies |Ai-Ai-1| <= d ( 0 <i<=|A|)) Now your task is to find the longest special subsequence of a certain sequence S Input There are no more than 15 cases , process till the end-of-file The first line of each case contains two integer n and d ( 1<=n<=100000 ,0<=d<=100000000) as in the description. The second line contains ......
阅读全文
  • 06月
  • 07日
综合 ⁄ 共 897字 评论关闭
<!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> </head> <body> <script> /* Browser Language Redirect script- By JavaScript Kit For this and over 400+ free scripts, visit http://www.javascriptkit.com This notice must stay intact */ //Enter ISO 639-2 letter Language codes to detect (see: http://www.w3.org/WAI/ER/IG/ert/iso639.htm): var langcodes=new Array("en","zh", "default") //Enter corresponding redir......
阅读全文
  • 05月
  • 26日
操作系统 ⁄ 共 4465字 评论关闭
1】两台服务器间拷贝文件: scp [-r] * 用户名@IP:目标路径     (*为待拷贝的文件;如果待拷贝的是目录,需要加上-r) 2】查看内存信息: free -m           单位:M free -b -s5      单位:bytes  每隔5s显示内存情况 3】chkconfig: 功能说明: 检查,设置系统的各种服务。主要用来更新(启动或停止)和查询系统服务的运行级信息。谨记chkconfig不是立即自动禁止或激活一个服务,它只是简单的改变了符号连接。 使用语法: chkconfig [--add][--del][--list][系统服务] 或 chkconfig [--level <等级代号>][系统服务][o......
阅读全文
  • 05月
  • 05日
综合 ⁄ 共 1006字 评论关闭
           C++语言是C语言的拓展,C语言是面向过程的,C++在C的基础上增加了面向对象的方法。         所谓面向过程的编程思想,就是分析解决问题的步骤,将这些步骤用一个个函数实现,最后一个个调用。         所谓面向对象的编程思想,就是将任何事物都看成一个对象,对象有各种属性(attribute)和行为(behavior),在解决问题的过程中,将系统分解,使之模块化。         相对于面向过程的思想,面向对象的思想更适用于大型系统的开发。         面向对象的程序设计有四个主要特点:抽象、封装、继承、多态。         抽象(abst......
阅读全文
  • 04月
  • 16日
综合 ⁄ 共 12484字 评论关闭
今天发现package中 NFC都没怎么好好看过,导致我写一个新的东西很难,所以决定今天把它剖析完。哈,发现找到我想要的东西就不想写全拉,嘿,果然还是很懒!! 因为新东西是跟NFC TAG有关,故从这里入手,需要看得为package下面的nfc文件夹里的东东 1. NfcService 这个是继承自Application. 应该是方便设一些全局变量。 里面有几个内部类NfcAdapterService,这个在下面介绍。 这其中还用到了keyguardManager 跟powerManager,表明有一段是跟屏幕有关。 定义了一个sharedPreference--NfcServicePrefs用来保存临时数据。  ......
阅读全文
  • 04月
  • 02日
综合 ⁄ 共 810字 评论关闭
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2544 Dijkstra算法应用 #include <iostream> using namespace std; const int intmax = 10000000; const int MAX = 102; int Map[MAX][MAX]; bool visited[MAX]; int dist[MAX]; int n, m; void Dijsktra() { int i, j; for (i = 1; i <= n; i++) dist[i] = Map[1][i]; visited[1] = 1; dist[1] = 0; for (j = 1; j <= n; j++) { int x = 1, m = intmax; for (i = 1; i <= n; i++) //寻找最短路 if (!visited[i] && dist[i] < m) ......
阅读全文
  • 02月
  • 22日
综合 ⁄ 共 2757字 评论关闭
Supermarket Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9103   Accepted: 3891 Description A supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral number of time units starting from the moment the sale begins. Each product takes precisely one unit of time for being sold. A selling schedule is an ordered subset of products Sell ≤ Prod such that the selling of each produ......
阅读全文
  • 02月
  • 15日
综合 ⁄ 共 1277字 评论关闭
一、逐个字符读文件 1.源代码 #include <stdio.h> int main() { FILE * fp; int i; char * path="./test.txt"; int ch; fp = fopen(path, "r"); if(fp == NULL) { perror("open error"); return 1; } printf("output data in test.txt\n"); for(i=0; i<5;i++) { ch = fgetc(fp); if(ch == EOF) { ......
阅读全文
  • 02月
  • 03日
综合 ⁄ 共 2401字 评论关闭
  package democreen.log4jexamples2; import java.io.*; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.HTMLLayout; import org.apache.log4j.WriterAppender; public class htmlandwrite {  static Logger logger = Logger.getLogger(htmlandwrite.class);  public static void main(String args[]) {   HTMLLayout layout = new HTMLLayout();   WriterAppender appender = null;   try {    FileOutputStream output = new FileOutputStream("src/democreen/log4jexamples2/output......
阅读全文
  • 01月
  • 20日
综合 ⁄ 共 1686字 评论关闭
  B-number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1561    Accepted Submission(s): 854 Problem Description A wqb-number, or B-number for short, is a non-negative integer whose decimal form contains the sub- string "13" and can be divided by 13. For example, 130 and 2613 are wqb-numbers, but 143 and 2639 are not. Your task is to calculate how many wqb-numbers from 1 to n for a given integer n.   Input Process till EOF. In e......
阅读全文
  • 01月
  • 16日
综合 ⁄ 共 2819字 评论关闭
J2EE提供了一种特殊的Servlet,就是Filter。它不是一种单独的网络组件,因为它不产生请求和响应信 息,它必须依附于其他的网络组件存在。所以我们利用它完成信息的编码转化、数据加密、身份验证、数据压缩、日志记录等很多种工作。下面我们共同看一下 Filter的结构和具体的应用方法,并且结合实例进行讲解。  一、Filter的结构  我们自己编写的Filter必须要实现javax.servlet.Filter接口,这个接口只要包含了三个主要的方法:  init()-初始化过滤器,它的输入参数javax.servlet.FilterConfig的一个实例,可以这里初始化过滤要使用......
阅读全文
  • 01月
  • 10日
综合 ⁄ 共 120字 评论关闭
rails 修改表列名 分类: Ruby on Rails 2009-03-10 23:49 105人阅读 评论(0) 收藏 举报 view plain def self.up       rename_column :表名, :要改的列名, :新的列名   end    
阅读全文