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

DraculaW

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

#

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

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

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

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

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

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)編輯 收藏

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

就是給一個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 閱讀(155) | 評論 (0)編輯 收藏

僅列出標題
共2頁: 1 2 
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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这里有精品热视频免费| 欧美精品在线视频| 亚洲淫性视频| 午夜日韩视频| 欧美日本高清视频| 亚洲理伦电影| 亚洲三级电影在线观看| 欧美v国产在线一区二区三区| 狠狠综合久久av一区二区小说| 午夜精品久久99蜜桃的功能介绍| 亚洲桃花岛网站| 国产精品一区二区三区久久| 欧美亚洲在线播放| 欧美自拍丝袜亚洲| 亚洲第一精品在线| 亚洲韩国一区二区三区| 欧美乱在线观看| 一区二区三区四区五区视频 | 亚洲精品美女久久久久| 欧美成人一品| 亚洲一区在线免费| 亚洲欧美日本精品| 曰韩精品一区二区| 亚洲国产精品视频一区| 欧美日韩精品免费观看视一区二区| 一区二区福利| 亚洲欧美在线一区二区| 在线观看成人小视频| 欧美激情免费观看| 国产精品久久久久国产精品日日| 久久精品国产免费| 免播放器亚洲一区| 亚洲欧美大片| 久久久久九九视频| 一区二区三区免费网站| 欧美与黑人午夜性猛交久久久| 亚洲破处大片| 亚洲视频中文字幕| 亚洲大胆美女视频| 一区二区三区免费看| 在线不卡中文字幕播放| 一区二区三区四区五区精品视频| 国内外成人在线视频| 亚洲免费高清视频| 极品中文字幕一区| 中文日韩在线| 亚洲美女色禁图| 欧美在线观看日本一区| 中日韩午夜理伦电影免费| 久久婷婷国产综合尤物精品| 亚洲一级二级| 免费观看成人网| 久久精品女人的天堂av| 欧美日韩一区二区三区在线视频| 噜噜噜躁狠狠躁狠狠精品视频| 欧美亚一区二区| 亚洲国产综合在线| 影音先锋中文字幕一区| 亚洲视频视频在线| 日韩视频第一页| 美日韩免费视频| 美女啪啪无遮挡免费久久网站| 国产精品激情av在线播放| 欧美激情网站在线观看| 免费短视频成人日韩| 欧美午夜电影网| 欧美激情视频一区二区三区免费| 国产亚洲视频在线观看| 亚洲午夜国产成人av电影男同| 亚洲欧洲综合| 欧美va天堂在线| 女人天堂亚洲aⅴ在线观看| 国产日韩欧美在线播放不卡| 一本大道久久精品懂色aⅴ| 亚洲激情av| 老司机午夜精品| 欧美国产日韩一区二区在线观看| 国产一区二区黄| 午夜精彩国产免费不卡不顿大片| 亚洲欧美成aⅴ人在线观看| 欧美日韩高清在线观看| 亚洲欧洲视频| 国产精品99久久久久久白浆小说| 欧美福利网址| 亚洲精品少妇30p| 亚洲视频观看| 国产精品久久久| 午夜精品久久久久久久久久久久久 | 久久精品视频在线免费观看| 羞羞视频在线观看欧美| 欧美性猛交xxxx乱大交退制版| 亚洲精品日韩在线| 亚洲一区二区精品| 国产精品久久久久久超碰| 亚洲一区bb| 久久大逼视频| 亚洲第一精品久久忘忧草社区| 乱码第一页成人| 亚洲第一精品福利| 日韩亚洲国产欧美| 欧美视频网站| 亚洲欧美日韩人成在线播放| 久久精品亚洲| 在线精品视频在线观看高清| 嫩模写真一区二区三区三州| 亚洲日本一区二区三区| 亚洲欧美日韩另类| 国产麻豆综合| 久久夜色精品亚洲噜噜国产mv | 欧美视频精品在线| 亚洲一区综合| 免播放器亚洲| 在线天堂一区av电影| 国产亚洲精品自拍| 欧美不卡视频一区发布| 99在线视频精品| 久久亚洲国产精品一区二区| 亚洲精品麻豆| 国产精品一区一区三区| 久久午夜精品一区二区| 一区二区三区免费在线观看| 欧美插天视频在线播放| 午夜精品一区二区在线观看 | 中文国产成人精品| 国内精品嫩模av私拍在线观看| 欧美大尺度在线观看| 久久综合九色九九| 欧美成人午夜视频| 午夜伦欧美伦电影理论片| **性色生活片久久毛片| 国产精品爱啪在线线免费观看| 久久国产日本精品| 99精品国产在热久久婷婷| 男女精品网站| 欧美一区二区啪啪| 一区二区三区日韩精品| 黄色日韩网站| 国产欧美日本一区二区三区| 欧美二区在线看| 久久av二区| 亚洲制服丝袜在线| 亚洲青涩在线| 久久亚洲欧洲| 午夜一区不卡| 亚洲午夜激情网站| 亚洲美女在线国产| 亚洲高清视频一区| 好吊一区二区三区| 国产精品综合不卡av| 国产精品白丝av嫩草影院 | 在线成人亚洲| 国产日韩欧美三区| 国产精品亚洲第一区在线暖暖韩国| 欧美日本亚洲| 欧美精品一区二区三区四区| 欧美11—12娇小xxxx| 久久久中精品2020中文| 欧美在线播放高清精品| 亚洲综合视频一区| 亚洲性xxxx| 亚洲网站在线| 亚洲在线免费| 亚洲女同在线| 午夜免费在线观看精品视频| 亚洲尤物精选| 亚洲在线观看视频网站| 亚洲欧美国产高清va在线播| 亚洲午夜视频在线| 亚洲影院免费| 欧美一区二区视频在线| 亚洲在线免费| 欧美亚洲自偷自偷| 久久精品国产亚洲5555| 久久婷婷影院| 欧美激情亚洲另类| 欧美四级在线观看| 国产精品久久久久999| 国产精品视频区| 黄色日韩精品| 亚洲免费观看高清在线观看| 亚洲午夜精品在线| 欧美影院久久久| 久久综合久久久久88| 欧美成人免费小视频| 亚洲国产成人高清精品| 亚洲高清在线精品| 99视频在线精品国自产拍免费观看| 一区二区三区不卡视频在线观看| 亚洲一本视频| 久久久国产精品亚洲一区| 免费观看欧美在线视频的网站|