现在位置: 首页 > gremlin发表的所有文章
  • 08月
  • 30日
综合 ⁄ 共 638字 评论关闭
题意:求一个字符串的最小表示的起始位置(字符串长度最大为10000)。 题目链接:http://poj.org/problem?id=1509 ——>>很久以前就听过师兄说最小表示,今天看周源的《浅析“最小表示法”思想在字符串循环同构问题中的应用》,找了这题,与论文里描述的题目一样。。 我觉得这个思想挺不错:一直维护着字典序较小的指针。。让另一个指针不断地缩小字典序。。直至成功或者失败结束。。 #include <cstdio> #include <cstring> using namespace std; const int maxn = 10000 + 10; char s[maxn]; int min_represen......
阅读全文
  • 05月
  • 15日
综合 ⁄ 共 2631字 评论关闭
注:摘自网络 Jim Grey spoke on distributed computing economics. Jim asks: Why is Seti@Home such a great idea? Why is Napster a great idea? Why is the computational grid uneconomic? When does computing on demand work? What is the “right” level of abstraction? Is the “access grid” the real killer app? Observation #1: Computing is free. 1 CPU day costs $1 (given a computer costs $1000). But the phone bill isn’t free. Internet bandwidth costs $50—500/mbps/m . So 1GB costs 1$ to send......
阅读全文
  • 03月
  • 25日
综合 ⁄ 共 4148字 评论关闭
我们在编写程序时,经常遇到两个模块的功能非常相似,只是一个是处理int数据,另一个是处理string数据,或者其他自定义的数据类型,但我们没有办法,只能分别写多个方法处理每个数据类型,因为方法的参数类型不同。有没有一种办法,在方法中传入通用的数据类型,这样不就可以合并代码了吗?泛型的出现就是专门解决这个问题的。读完本篇文章,你会对泛型有更深的了解。为什么要使用泛型为了了解这个问题,我们先看下面的代码,代码省略了一些内容,但功能是实现一个栈,这个栈只能处理int数据类型:public class Stack    {        ......
阅读全文
  • 10月
  • 24日
综合 ⁄ 共 1484字 评论关闭
Refer from http://blog.csdn.net/yangtrees/article/details/7573919 [cpp] view plaincopyprint? #include "cv.h"   #include "highgui.h"      bool check_line_state=false;   IplImage* workImg;   IplImage* imgshow;   CvRect ROI_rect;      void on_mouse4(int event, int x,int y,int flags,void* param)   {       int thickness=2;       CvPoint p1,p2;       if(event==CV_EVENT_LBUTTONDOWN)       {           //当前鼠标位置(x,y)           ROI_rect.x=x;           ROI_rect.y=y;           check_lin......
阅读全文
# Production  冰山一角的悲剧啊 Started GET "/discount_service/assets/admin.js?body=1" for 127.0.0.1 at 2014-05-23 14:50:24 +0800 ActionController::RoutingError (No route matches [GET] "/discount_service/assets/admin.js"): actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call' actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app' railties (4.0.0) lib/rails/rack/lo......
阅读全文
  • 06月
  • 10日
综合 ⁄ 共 303字 评论关闭
最近重新安装笔记本电脑,安装完成之后死活找不到声卡,电脑型号为dell vostro 1088,上网搜索一圈,包括严格规范驱动安装的顺序,但问题始终得不到解决。 首先,电脑硬件肯定是好的,安装之前声卡是可以正常工作的。 其次,一直有pci device驱动找不到,应该是此驱动导致的声卡无法识别,到网上找了一圈,包括dell的官网都没有找到驱动,深陷困境。 面对正版的xp简直束手无策,后来仔细一下,会不会因为没有安装windows xp sp3导致的呢? 想到此,立即到网上下载sp3的补丁安装, 安装之后,问题得以解决。(悲剧的xp安装盘,刻盘......
阅读全文
最近在linux下安装了opencv,但是在使用过程中,不能打开avi视频,网上有人说是因为没有安装ffmpeg的缘故 因此我特地安装了ffmpeg,遇到些许问题。“cannot restore segment prot after reloc: Permission denied” 网上找了很多方法,最后经过测试以下方法可行 这是因为SELINUX的问题,需要关闭SELINX,执行: #/usr/sbin/setenforce 0
阅读全文
<server xmlns="http://caucho.com/ns/resin"            xmlns:resin="http://caucho.com/ns/resin/core">      <host-default>        <web-app id="/resin-admin" document-directory="${resinHome}/php/admin">          <authenticator jndi-name="caucho/admin/auth">            <type>com.caucho.server.security.XmlAuthenticator</type>            <init path="${serverRoot}/conf/password.xml"/>          </authenticator>          <login-config auth-method......
阅读全文
  • 05月
  • 10日
综合 ⁄ 共 1721字 评论关闭
IO包最重要的五个类和一个接口 File/OutputStream/InputStream(字节流)/Writer/Reader(字符流) 一个接口:Serializable   File类: 字节流: OutputStream与InputStream是抽象类 OutputStream是整个IO包中,字节输出流的最大类 FileOutputStream是一个子类,通常用整个子类通过多态实例化OutputStream       packageiotest;   importjava.io.File; importjava.io.FileNotFoundException; importjava.io.IOException; importjava.io.OutputStream; importjava.io.FileOutputStream; importjava.io.InputStream; importjava.io.......
阅读全文
  • 05月
  • 02日
综合 ⁄ 共 2912字 评论关闭
Cat vs. Dog Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1588    Accepted Submission(s): 602 Problem Description The latest reality show has hit the TV: ``Cat vs. Dog''. In this show, a bunch of cats and dogs compete for the very prestigious Best Pet Ever title. In each episode, the cats and dogs get to show themselves off, after which the viewers vote on which pets should stay and which should be forced to leave the show. Each ......
阅读全文
  • 05月
  • 01日
综合 ⁄ 共 226字 评论关闭
有一些极端情况,用scanf会超时,用putchar 下面为读数字 void nextInt(int &x) //输入外挂 { do c=getchar(); while (c<'0'||c>'9'); x=c-'0'; while ('0'<=(c=getchar())&&c<='9') x=x*10+c-'0'; } void Out(int a) //输出外挂 { if(a>9) Out(a/10); putchar(a%10+'0'); } 参考: poj 1904(强连通分量+输入输出外挂)
阅读全文
  • 05月
  • 01日
综合 ⁄ 共 800字 评论关闭
#include <stdio.h> #include <stdio.h> #include <malloc.h> //定义链表结构体 typedef struct node { char name[20]; struct node *prior; struct node *next; }stud; //创建链表,其中链表的节点数是count stud *create(int count) { stud *pNewNode = NULL; stud *pNode = NULL; stud *head = NULL; int i; //初始化头结点 head = (stud*)malloc(sizeof(stud)); head->name[0] = '\0'; head->next = NULL; head->prior = NULL; pNode = head; for(i = 0;i < count;i++) //循环......
阅读全文