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

DraculaW

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

2008年11月28日 #

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

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

2007年11月22日 #

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

2007年11月21日 #

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

2007年11月20日 #

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

     摘要: STL與boost的type traits  閱讀全文
posted @ 2007-11-15 20:43 DraculaW 閱讀(955) | 評論 (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 閱讀(321) | 評論 (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 閱讀(510) | 評論 (0)編輯 收藏

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

其實這個題目也很簡單 有很多種做法...

就是給一個array你 然后你找出 i,j使從第i個加到第j個最大就好了啊

最簡單的算法就是兩個for 算下來不到n^2的時間復雜度 可是還有更快的算法哦

首先 可以使用分治算法 這樣的算法大概時間復雜度是 n*lg n, 但是這樣還不是最好的

最好的其實是把前一個狀態儲存下來然后進行比較 這個算法時間復雜度只有n哦 很快的呢

先不要看 給個 int a[10] = { 31, -41, 59, 26, -53, 58, 97, -93, -23, 84 }

求它的最大子串有多大哦

inline int
max( int a, int b)
{
    return a > b ? a : b;
}

/*****************************************************************************
* This Function count a array find the largest string count max              *
* Function : CountMax                                                        *
* int    *a : the array of int                                                *
* int     n : the range of array                                              *
* return    : the sum of max this function find                               *
*****************************************************************************/
int
CountMax ( int *a, int n )
{
    int sum = 0, tmp = 0;
    for( int i = 0; i < n; i++ )
    {
        tmp = max( 0, tmp + a[i] );
        sum = max( sum, tmp );
    }

    return sum;
}
/* -----   end of function CountMax   ----- */
posted @ 2007-11-15 20:37 DraculaW 閱讀(162) | 評論 (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>
            亚洲高清一区二区三区| 亚洲国产精品成人综合| 午夜精品视频在线观看| 亚洲欧洲日本国产| 欧美freesex交免费视频| 亚洲国产日韩在线一区模特| 亚洲午夜免费视频| 9久re热视频在线精品| 欧美色中文字幕| 亚洲免费小视频| 午夜精品久久久久久久99黑人 | 亚洲国产经典视频| 欧美大色视频| 亚洲在线视频观看| 午夜精品久久久久久久男人的天堂| 国产精品在线看| 久久综合狠狠综合久久综合88| 91久久精品视频| 欧美一区二区私人影院日本| 免费在线成人| 精品成人a区在线观看| 欧美国内亚洲| 久久精品一区二区国产| 亚洲欧洲在线视频| 免费看的黄色欧美网站| 欧美日本久久| 久久久久久一区二区| 一个色综合导航| 欧美精品在线一区| 久久精品成人欧美大片古装| 99综合在线| 欧美精品三级日韩久久| 影音先锋日韩有码| 蜜桃av一区二区在线观看| 欧美一级专区免费大片| 国产精品美女视频网站| 亚洲第一页中文字幕| 久久久久九九九| 精品不卡视频| 牛牛精品成人免费视频| 欧美日韩在线不卡一区| 欧美成年人网站| 国产日本欧美视频| 亚洲精品日韩激情在线电影| 好吊妞**欧美| 欧美成人午夜剧场免费观看| 国产精品久久久久久久app| 欧美韩国日本综合| 欧美成人官网二区| 亚洲破处大片| 久久免费黄色| 久久精品伊人| 国产日韩欧美精品| 久久九九99视频| 欧美视频中文字幕在线| 亚洲激情小视频| 在线看片日韩| 亚洲人永久免费| 国产精品xnxxcom| 亚洲国产日韩在线| 亚洲第一色在线| 亚洲靠逼com| 亚洲精品四区| 亚洲综合日韩在线| 亚洲午夜精品17c| 欧美日韩一区二区三区在线| 西西裸体人体做爰大胆久久久| 欧美三区视频| 久久亚裔精品欧美| 欧美激情精品久久久久久免费印度| 久久一区二区三区国产精品| 欧美精品久久一区| 亚洲精品美女在线| 国产日产精品一区二区三区四区的观看方式 | 欧美专区日韩专区| 在线日韩电影| 久久亚洲精品视频| 亚洲大片在线观看| 亚洲免费高清| 欧美在线视频a| 99精品国产在热久久| 欧美一级理论片| 久久亚洲精品伦理| 亚洲精品日韩精品| 午夜一区二区三区在线观看| 久久久99精品免费观看不卡| 欧美激情国产日韩| 亚洲图片你懂的| 亚洲激情在线播放| 香蕉久久久久久久av网站| 亚洲人午夜精品| 欧美日韩一区精品| 久久电影一区| 亚洲成人在线视频播放 | 欧美黄网免费在线观看| 99精品99久久久久久宅男| 国产精品久久久久久久久久久久| 亚洲综合精品自拍| 亚洲一区二区免费看| 久久婷婷丁香| 亚洲精品美女| 亚洲美女尤物影院| 久久久久久久波多野高潮日日 | 中文亚洲欧美| 国产尤物精品| 欧美区高清在线| 性欧美暴力猛交69hd| 亚洲综合欧美日韩| 黄色一区二区三区| 欧美日韩综合在线免费观看| 久久精品国产欧美激情| 久久激情综合网| 国产精品一区二区视频| 久久伊人一区二区| 久久在线免费观看| 正在播放亚洲| 欧美日韩国产一区精品一区 | 亚洲美女中文字幕| 麻豆freexxxx性91精品| 亚洲一二区在线| 国产精品黄色| 欧美成人精品一区二区| 欧美一区二区三区视频在线观看| 亚洲精品国产系列| 麻豆成人av| 久久久久在线观看| 午夜精品一区二区三区电影天堂| 亚洲欧洲日本一区二区三区| 国产原创一区二区| 国产精品视频大全| 欧美性jizz18性欧美| 欧美经典一区二区三区| 免费日韩精品中文字幕视频在线| 欧美怡红院视频一区二区三区| 久久精品二区三区| 伊人久久综合| 一区二区三区中文在线观看| 国产亚洲精品aa午夜观看| 久久av一区二区三区漫画| 美女网站在线免费欧美精品| 亚洲国产成人精品视频| 欧美日韩在线免费观看| 午夜精品视频在线| 亚洲午夜免费福利视频| 久久一区二区三区四区| 久久久久久穴| 日韩视频在线一区| 国产精品外国| 国产伦精品一区| 裸体女人亚洲精品一区| 一区二区三区毛片| 在线亚洲精品| 亚洲欧美清纯在线制服| 亚洲一区视频在线| 亚洲欧美国产精品va在线观看| 欧美a级片一区| 最新热久久免费视频| 欧美伊久线香蕉线新在线| 亚洲国产欧美另类丝袜| 国产精品日韩专区| 欧美v国产在线一区二区三区| 久久综合中文色婷婷| 欧美成人免费观看| 欧美日韩精选| 免费短视频成人日韩| 欧美成人dvd在线视频| 欧美一区二区三区的| 久久理论片午夜琪琪电影网| 老司机一区二区三区| 欧美日韩国产91| 久久在线免费观看| 欧美一级黄色录像| 欧美国产免费| 国产精品久久国产三级国电话系列| 蘑菇福利视频一区播放| 欧美精品一区二区蜜臀亚洲| 国产精品久久久久7777婷婷| 欧美成年人视频网站| 欧美视频中文一区二区三区在线观看| 久久亚洲电影| 欧美日韩综合不卡| 欧美日本一区二区高清播放视频| 国产精品久久福利| 亚洲黄一区二区| 欧美中文字幕在线| 欧美激情网友自拍| 欧美激情中文字幕一区二区| 久久三级视频| 久久久女女女女999久久| 亚洲精品国偷自产在线99热| 欧美成人免费大片| 快射av在线播放一区| 久久伊人免费视频| 久久手机免费观看| 久久久亚洲一区| 在线午夜精品自拍| 亚洲在线视频网站| 午夜激情久久久| 欧美在线免费一级片| 久久久久久久一区|