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

DraculaW

  C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
  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日 #

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

2007年11月20日 #

     摘要: 大概的介紹了下deque的實現
為什么要用這種實現方式 誰能解釋一下  閱讀全文
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可以轉換為U 于是就調用Test(U)這個函數 返回一個char;
如果不能 就調用使用(...)缺省參數的函數 返回一個數組

然后對返回值進行判斷....
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)編輯 收藏

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

手機的英文智能輸入法其實很簡單的想法 使用哈希來實現 呵呵

1       2       3
,.    abc    def

4       5       6
ghi    jkl    mno

7       8       9
pqrs tuv   wxyz

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

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

不過拼音輸入的狀態機應該更復雜一些。因為拼音輸入可以根據前一個字來推斷可能出現的下一個字。

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

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

僅列出標題  下一頁
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            国产目拍亚洲精品99久久精品| 亚洲二区免费| 国产精品久久久久久久第一福利| 久热这里只精品99re8久| 黄色成人在线免费| 久久国产精品一区二区三区| 亚洲欧美经典视频| 亚洲欧美三级伦理| 欧美一区网站| 久久综合图片| 欧美日韩精品伦理作品在线免费观看| 欧美极品aⅴ影院| 国产精品三级视频| 亚洲国产成人porn| 亚洲午夜一二三区视频| 欧美伊人久久久久久午夜久久久久 | 欧美日产在线观看| 国产精品久久久爽爽爽麻豆色哟哟| 国产欧美大片| 亚洲精品视频在线| 久久福利毛片| 91久久中文| 欧美综合国产| 欧美日韩大陆在线| 狠狠爱综合网| 亚洲少妇一区| 欧美jizzhd精品欧美喷水| 日韩一本二本av| 久久亚洲影院| 国产人成一区二区三区影院| 亚洲免费av观看| 蜜桃久久av一区| 午夜精品视频网站| 国产精品av久久久久久麻豆网| 亚洲成人在线视频网站| 欧美亚洲日本一区| 9久草视频在线视频精品| 久久精品视频在线免费观看| 欧美午夜精品| 99av国产精品欲麻豆| 久久亚洲欧美| 国产精品99久久久久久久久久久久 | 国产精品专区一| 日韩午夜电影| 欧美大片一区二区三区| 欧美一区二区三区婷婷月色| 欧美日韩在线免费观看| 亚洲第一在线| 免费中文日韩| 久久久久久久一区| 国内精品久久久| 欧美在线视频导航| 亚洲免费人成在线视频观看| 久久久久国产精品厨房| 女女同性精品视频| 久久久水蜜桃| 一区二区欧美激情| 欧美精品午夜| 9人人澡人人爽人人精品| 欧美不卡一卡二卡免费版| 欧美专区日韩专区| 国产日产欧美一区| 久久aⅴ国产欧美74aaa| 欧美一级二区| 国产一区二区日韩精品| 羞羞视频在线观看欧美| 亚洲在线观看视频| 国产精品成人一区| 亚洲一区精品电影| 亚洲天堂偷拍| 国产日韩欧美| 久久精品中文字幕一区| 欧美在线|欧美| 国语自产偷拍精品视频偷| 久久久久亚洲综合| 久久精品在线播放| 亚洲福利视频专区| 亚洲国产精品久久久久久女王| 欧美成ee人免费视频| 9l视频自拍蝌蚪9l视频成人| 亚洲激情av| 国产精品xnxxcom| 久久久综合精品| 欧美成人性网| 中文欧美日韩| 亚洲一区二区高清视频| 韩国女主播一区二区三区| 亚洲国产美女精品久久久久∴| 欧美精品尤物在线| 欧美一区二区在线| 久久一区亚洲| 亚洲无人区一区| 久久精品国产亚洲一区二区三区 | 中文亚洲免费| 久久久久久久久岛国免费| 亚洲国产精品福利| 在线播放豆国产99亚洲| 亚洲国产精品成人综合色在线婷婷 | 国产精品ⅴa在线观看h| 亚洲一区二区在线免费观看视频| 午夜精品久久久久久久久久久久| 国产视频亚洲| 亚洲人成7777| 国产亚洲精品综合一区91| 欧美成人嫩草网站| 国产精品免费福利| 欧美国产视频日韩| 国产精品美女主播在线观看纯欲| 久久艳片www.17c.com| 欧美国产先锋| 久久精品免费播放| 亚洲精品乱码久久久久| 欧美一区亚洲二区| 久久久噜噜噜久久| 在线性视频日韩欧美| 亚洲欧美日韩在线高清直播| 激情自拍一区| 日韩视频中午一区| 亚洲国产精品一区二区www在线| 亚洲午夜激情| 亚洲午夜久久久久久尤物| 久久精品一本| 先锋影音久久久| 国产精品盗摄一区二区三区| 老**午夜毛片一区二区三区| 国产精品性做久久久久久| 亚洲狼人综合| 亚洲精品在线免费观看视频| 久久久噜噜噜久噜久久 | 国产精品porn| 亚洲国产精品99久久久久久久久| 国产一区二区三区久久| 一区二区三区免费在线观看| 一片黄亚洲嫩模| 欧美成人首页| 亚洲第一精品夜夜躁人人爽 | 久久精品导航| 欧美一区在线看| 国产精品久久久久国产精品日日| 免费在线日韩av| 国产一区二区三区四区老人| 欧美亚洲色图校园春色| 亚洲综合色视频| 国产精品一卡二卡| 亚洲欧美日韩精品一区二区| 午夜精品久久久久久久| 欧美日韩一级黄| 一区二区三区高清视频在线观看| 亚洲一级二级在线| 欧美视频在线观看 亚洲欧| 一区二区不卡在线视频 午夜欧美不卡' | 亚洲最新视频在线播放| 欧美电影在线观看| 亚洲国产精品女人久久久| 日韩一二在线观看| 欧美片第一页| 亚洲天堂av综合网| 久久九九热re6这里有精品| 国产精品自拍一区| 欧美一乱一性一交一视频| 久久日韩粉嫩一区二区三区| 在线播放不卡| 欧美精品激情blacked18| 一区二区三区蜜桃网| 欧美在线观看视频在线| 精品av久久久久电影| 免费成人av在线| 一本色道久久综合亚洲二区三区| 亚洲综合精品四区| 激情小说另类小说亚洲欧美| 欧美二区在线播放| 亚洲精品一区久久久久久| 亚洲深夜福利网站| 国产日韩欧美自拍| 亚洲视频一区二区| 久久久无码精品亚洲日韩按摩| 亚洲国产成人精品女人久久久| 免费在线国产精品| 99xxxx成人网| 久久最新视频| 99综合在线| 国产精品亚洲美女av网站| 久久国产色av| 99热免费精品| 久久久久网址| 亚洲欧美日韩国产综合精品二区| 国产亚洲欧美日韩一区二区| 欧美黑人国产人伦爽爽爽| 亚洲已满18点击进入久久| 久久一本综合频道| 一区二区三区免费观看| 国内精品美女在线观看| 欧美激情欧美激情在线五月| 一本色道久久| 宅男噜噜噜66国产日韩在线观看| 国产日韩欧美日韩| 欧美日韩免费一区二区三区视频| 久久疯狂做爰流白浆xx| 亚洲免费久久| 亚洲国产综合在线|