青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

DraculaW

  C++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
  19 隨筆 :: 0 文章 :: 7 評論 :: 0 Trackbacks

2008年11月28日 #

     摘要: 我嘗試寫的一個智能指針
希望大家能幫我提一些意見 謝謝

上面是測試碼
下面是代碼  閱讀全文
posted @ 2008-11-28 17:39 DraculaW 閱讀(417) | 評論 (0)編輯 收藏

2007年11月22日 #

     摘要: 紅黑樹的插入算法的描述 不知道清楚么 希望大家指正  閱讀全文
posted @ 2007-11-22 20:47 DraculaW 閱讀(325) | 評論 (0)編輯 收藏

2007年11月21日 #

     摘要: 對內(nèi)存分配算法的一點想法 希望大家指正  閱讀全文
posted @ 2007-11-21 22:38 DraculaW 閱讀(1983) | 評論 (1)編輯 收藏

2007年11月20日 #

     摘要: 大概的介紹了下deque的實現(xiàn)
為什么要用這種實現(xiàn)方式 誰能解釋一下  閱讀全文
posted @ 2007-11-20 22:30 DraculaW 閱讀(1178) | 評論 (0)編輯 收藏

2007年11月15日 #

template<typename T, typename U>
class Conversion
{
    typedef char Small;
    class Big{char dummy[2];};
    static Small Test(U)    {   }  
    static Big Test(...) { }  
    static T MakeT() { }
   
public:
    enum { exists = sizeof(Test(MakeT())) == sizeof(Small)};   
};

如果T可以轉(zhuǎn)換為U 于是就調(diào)用Test(U)這個函數(shù) 返回一個char;
如果不能 就調(diào)用使用(...)缺省參數(shù)的函數(shù) 返回一個數(shù)組

然后對返回值進(jìn)行判斷....
posted @ 2007-11-15 20:45 DraculaW 閱讀(282) | 評論 (0)編輯 收藏

     摘要: STL與boost的type traits  閱讀全文
posted @ 2007-11-15 20:43 DraculaW 閱讀(946) | 評論 (0)編輯 收藏

# The readfpl accept a file's path while is fpl(foobar play list),
# and return a list which holds all the file'path
sub readfpl
{
    my @files;
    my @chunks;
    my $index = 0;

    open(INPUT, "< $_[0]")
        or die "can't open";

    @chunks = split(m{file://}, <INPUT>);

    foreach(@chunks)
    {   
        if($_ =~ m/.+\.(mp3|wma|m4a)/)
        {
            $files[$index] = $&;
            $index ++;
        }
    }

    print $files[0];
   
    return @files;
}

my @files = readfpl($ARGV[0]);
my $string;

foreach(@files){
     $string = $_;
        # the next while get name from path
     while( substr($string, 1) =~ m{\\.+\.(mp3|wna|m4a)}) {
         $string = $ARGV[0].$&;
         }
     rename $_, string;
}

將這段代碼存為movefpl.pl然后在命令行打入 movefpl.pl 播放列表的全路徑 要存歌曲的新路徑
就可以了呢 呵呵
posted @ 2007-11-15 20:41 DraculaW 閱讀(315) | 評論 (0)編輯 收藏

Assessing Infection

Background

According to the World Health Organization, infectious disease ranks as the leading cause of death in the world. In 1998 alone, over 17 million people died from infectious and parasitic diseases such as acute lower respiratory infections, tuberculosis, HIV/AIDS, and malaria. It is forecast that infectious disease will continue to kill millions of people, especially those living in developing countries.

The medical profession and scientific community of the world are fighting the infectious disease threat with new tools and technologies from a variety of fields. From this effort, a new field of research has emerged. Infectious Disease Epidemiology is the study of the variables that influence the growth and spread of infectious diseases. This relatively new field combines molecular biology, immunology, genetics, and the computational sciences. A focus of this field is the study of the factors that influence the growth of an infectious disease within a single organism, and the factors that influence the pattern of infection across an entire population.

Description

This assignment asks you to finish the implementation of a program that assesses the level of infection in a tissue sample. You are given data representing a rectangular tissue sample, overlaid with a grid. Certain portions of the tissue are infected; others are not. Your goal is to help assess the extent of the infection by writing a program that, given the coordinates of a colony of infection, can determine its size.

A typical use of the program follows. The user interacts with the program only through command-line arguments. The user supplies to the program a data filename and the coordinates of a cell in the grid. The coordinates are specified by row and then column, both starting at zero. The program calculates the extent of infection at that coordinate and outputs a two-dimensional representation of the tissue sample. Figure 1 depicts the execution of the program.

A screen shot from a sample solution
Figure 1 Output from a sample solution

For the purpose of this assessment, we consider a "colony" of infected tissue to be a set of adjacent and infected cells. In Figure 1, we can see three separate colonies. The smallest colony consists of two cells and is located in the lower left corner of the grid. Another colony consisting of three infected cells exists on the far right edge of the grid. The largest colony of eight cells resides primarily in the middle of the grid. This colony has a small arm into the upper left corner of the grid. Notice from this colony that cells residing in diagonals are considered "adjacent." The plus signs next to the cells in this largest colony indicate that they all belong to the colony that contains the user entered coordinate.


solution :

#ifndef GRID_H
#define GRID_H

#include <string>
#include <vector>

using namespace std;

/*
* IMPORTANT NOTE:
*
* For this assignment, you might need to add state to the
* class and/or augment existing methods, and/or create private helper
* methods, but you should not delare new public methods
*/

const bool INFECTED = true;
const bool NOT_INFECTED = false;

class grid;

class grid {

private:
    int rows;
    int cols;
    vector<bool> *area;
    vector<bool> *infect;
    int indexof (int row, int col) const;
    bool infected(int row, int col) const;

public:
    grid (string file);
    ~grid ();

    int count (int row, int col);

    friend ostream &operator<<(ostream &stream, const grid& ob);

};

#endif

============================================================================

#include <iostream>
#include <fstream>

using namespace std;

#include "grid.h"

// You do not need to alter function indexof.
int grid::indexof (int row, int col) const {
    return row*cols+col;
}

// You do not need to alter function infected.
bool grid::infected(int row, int col) const {
    return (area->operator[](indexof(row, col)) == INFECTED);
}

// You may need to alter the constructor
grid::grid (string file) {

    ifstream grid_file;

    grid_file.open (file.c_str());

    grid_file >> rows;
    grid_file >> cols;

    area = new vector<bool>(rows*cols, NOT_INFECTED);
    infect = new vector<bool>(rows*cols, NOT_INFECTED);
   
    while (true) {

        int blob_row;
        int blob_col;

        grid_file >> blob_row;
        grid_file >> blob_col;

        if (grid_file.eof()) {
            break;
        }

        area->operator[](indexof(blob_row,blob_col)) = INFECTED;
    }

    grid_file.close();
}

// You may need to alter the destructor
grid::~grid () {
    delete area;
    delete infect;
}

// You will need to alter this function to display the
// plus signs (+) next to the cells that belong to
// a counted colony.
ostream &operator<<(ostream &stream, const grid& ob) {

    for (int row=0; row < ob.rows; row++) {
   
        for (int col=0; col < ob.cols; col++) {

            stream << ob.area->operator[](ob.indexof(row, col));
            if( ob.infect->operator[] ( ob.indexof(row, col) ) )
                stream << "+ ";
            else
                stream << "   ";
        }

        stream << endl;
    }

    stream << endl;
    return stream;
}

// Replace the return statement in this function with your
// recursive implementation of this method */
int grid::count (int row, int col) {

    if( row < 0 || col < 0 || row == rows || col == cols)
        return 0;

    if( area->operator[](indexof(row,col) ) == NOT_INFECTED )
        return 0;

    if(infect->operator[](indexof(row,col)) == INFECTED)
        return 0;

    infect->operator[](indexof(row,col)) = INFECTED;

    // Recursive test the 8 point near the point
    // which area is INEFCTED and infect is NOT_INFECTED

    return    count( row - 1, col - 1 ) + count ( row - 1, col )
        + count( row - 1, col + 1 ) + count( row, col - 1 )
        + count( row, col ) + 1 + count( row, col + 1 )
        + count( row + 1, col - 1 ) + count( row + 1, col )
        + count( row + 1, col + 1 );
}
posted @ 2007-11-15 20:40 DraculaW 閱讀(502) | 評論 (0)編輯 收藏

     摘要: 一道簡單的作業(yè)貼 呵呵   閱讀全文
posted @ 2007-11-15 20:39 DraculaW 閱讀(460) | 評論 (0)編輯 收藏

手機(jī)的英文智能輸入法其實很簡單的想法 使用哈希來實現(xiàn) 呵呵

1       2       3
,.    abc    def

4       5       6
ghi    jkl    mno

7       8       9
pqrs tuv   wxyz

譬如說輸入 43
進(jìn)入這個哈希里面去尋找
key[43] -> [if] -> [he] -> [id] -> [ie]-> [ge] -> [gf] -> 0
還可以輸入更多的 呵呵。

以此類推,如果是拼音輸入也是一樣,只不過要多進(jìn)行一次哈希。從拼音哈希到具體的漢字里面去。

不過拼音輸入的狀態(tài)機(jī)應(yīng)該更復(fù)雜一些。因為拼音輸入可以根據(jù)前一個字來推斷可能出現(xiàn)的下一個字。

其實 不只是手機(jī),只要是使用數(shù)字鍵盤的機(jī)器都可以使用這樣子的輸入法。

使用這種算法的變種還可以實現(xiàn)一個好玩的游戲:就是輸入一個單詞,然后輸出所有與它組成元素相同的單詞(就是輸入stop 它可以輸出tops等單詞)。具體也是使用哈希。哈希真是一個好算法
posted @ 2007-11-15 20:37 DraculaW 閱讀(342) | 評論 (0)編輯 收藏

僅列出標(biāo)題  下一頁
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            免费亚洲电影| 亚洲高清在线视频| 午夜精品视频在线观看| 欧美成人四级电影| 久久se精品一区精品二区| 欧美午夜免费| 亚洲午夜精品17c| 亚洲精选大片| 欧美精品尤物在线| 亚洲欧洲日本专区| 欧美黄色成人网| 欧美va亚洲va香蕉在线| 亚洲黄网站在线观看| 亚洲国产精品第一区二区三区 | 久久精品电影| 国产麻豆91精品| 久久国产成人| 久久国产免费看| 亚洲第一毛片| 亚洲激情视频| 欧美三级特黄| 午夜视频精品| 午夜一区二区三视频在线观看| 亚洲精品国产无天堂网2021| 久久成人18免费网站| 激情综合视频| 亚洲电影专区| 欧美片在线播放| 亚洲女人天堂av| 欧美在现视频| 亚洲激情综合| 夜色激情一区二区| 国产精品一区视频| 猛干欧美女孩| 欧美日韩伊人| 久久久久久久激情视频| 欧美成人a∨高清免费观看| 中文久久精品| 欧美中文字幕在线观看| 亚洲精品乱码久久久久| 一区二区三区精品视频| 国产专区一区| 亚洲欧洲日韩女同| 国产日韩欧美视频在线| 亚洲电影天堂av| 国产农村妇女精品一区二区| 欧美激情2020午夜免费观看| 国产精品美女黄网| 欧美激情网友自拍| 国产人妖伪娘一区91| 亚洲黄色一区| 国精品一区二区三区| 亚洲乱码精品一二三四区日韩在线 | 免费亚洲电影在线| 亚洲欧美日韩在线不卡| 久久精品一区二区三区四区| 99re6热在线精品视频播放速度| 亚洲一区三区在线观看| 91久久精品国产| 午夜性色一区二区三区免费视频| 亚洲国产高清一区| 亚洲欧美日韩国产精品| 99精品国产高清一区二区| 久久精品欧洲| 欧美亚洲日本一区| 欧美精品少妇一区二区三区| 久久婷婷国产综合精品青草 | 亚洲国产精品va| 亚洲综合三区| 国产精品99久久久久久宅男 | 欧美一区二区三区免费看| 欧美激情a∨在线视频播放| 免费一级欧美片在线播放| 国产精品制服诱惑| 亚洲一区二区久久| 亚洲图片欧美日产| 欧美精品一区二区三区在线看午夜| 毛片基地黄久久久久久天堂| 国产欧美日韩不卡| 亚洲特色特黄| 亚洲午夜国产成人av电影男同| 巨乳诱惑日韩免费av| 久久综合色影院| 依依成人综合视频| 久久一本综合频道| 欧美成人午夜剧场免费观看| 激情综合在线| 久久久国产91| 免费在线成人| 91久久久亚洲精品| 欧美黄色影院| av成人免费观看| 亚洲视频你懂的| 欧美三级第一页| 亚洲五月六月| 久久国产一区二区| 国产视频精品va久久久久久| 亚洲一区欧美一区| 久久精品91久久久久久再现| 国产亚洲亚洲| 久久一二三四| 亚洲黄色免费电影| 一区二区三区成人精品| 欧美日韩在线一区| 亚洲欧美另类久久久精品2019| 欧美一区午夜精品| 尹人成人综合网| 欧美激情一区二区三区全黄| 亚洲乱码国产乱码精品精 | 午夜激情亚洲| 老色鬼精品视频在线观看播放| 在线观看国产欧美| 亚洲午夜久久久久久久久电影院| 欧美日韩一区二区在线播放| 99re6这里只有精品| 欧美一级二区| 亚洲电影欧美电影有声小说| 欧美不卡一区| 一本在线高清不卡dvd| 欧美在线观看一区二区三区| 亚洲人体一区| 羞羞答答国产精品www一本| 国产一区二区成人久久免费影院| 久久久久久久97| 亚洲黄色一区| 久久久久.com| 亚洲精品一区二| 国产精品乱码| 美女爽到呻吟久久久久| 日韩午夜电影在线观看| 久久精品国产第一区二区三区最新章节 | 亚洲伦理在线观看| 欧美午夜视频一区二区| 国语自产精品视频在线看抢先版结局| 日韩一级二级三级| 亚洲影视在线| 亚洲日本va午夜在线电影| 欧美午夜女人视频在线| 久久国产精品久久国产精品 | 久久一区激情| 久久综合图片| 亚洲人成人一区二区三区| 久久亚洲视频| 国产精品一区二区欧美| 午夜精品久久久久久久久| 亚洲国产精品va在线观看黑人 | 亚洲深夜福利网站| 欧美精品成人91久久久久久久| 老牛嫩草一区二区三区日本| 欧美专区中文字幕| 嫩草成人www欧美| 午夜精品一区二区三区四区| 国产精品国产三级国产专播品爱网 | 久久这里只有| 亚洲高清电影| 国产精品久久久久77777| 国产日本欧美在线观看| 亚洲美女淫视频| 一区二区三区精密机械公司| 国产精品久久久久久久午夜片| 一区二区三区精品在线| 99综合精品| 激情综合自拍| 一区二区欧美日韩| 樱桃国产成人精品视频| 欧美jizzhd精品欧美喷水 | 国产九区一区在线| 久久尤物视频| 欧美亚男人的天堂| 免费成人毛片| 在线观看日韩av| 国产欧美一区视频| 久久大综合网| 亚洲男女毛片无遮挡| 91久久综合亚洲鲁鲁五月天| 在线播放视频一区| 一色屋精品视频在线看| 国内精品免费午夜毛片| 国产午夜精品久久久久久久| 国产欧美视频一区二区三区| 国产精品一区在线观看| 国产精品久久777777毛茸茸| 欧美日韩亚洲网| 欧美视频观看一区| 国产精品国产三级国产aⅴ浪潮| 欧美日韩另类视频| 欧美三级乱人伦电影| 国产精品高潮久久| 国产欧美精品一区aⅴ影院| 国内精品久久久久久久影视麻豆| 国产亚洲欧美一区在线观看| 国内自拍视频一区二区三区| 亚洲成色777777女色窝| 亚洲人成网站在线播| 日韩一区二区精品| 亚洲女同精品视频| 久久久久久久999| 免费中文字幕日韩欧美| 91久久精品国产91久久性色| 亚洲最新中文字幕|