`
xitongyunwei
  • 浏览: 921512 次
文章分类
社区版块
存档分类
最新评论

Top coder competition May 26th,2007

 
阅读更多

My code as below for the firstitem:

#include "stdafx.h"
#include "vector"
#include "string"
using namespace std;

class FirstMazeTask
{
public:
string checkCorrectness(vector <string> maze)
{
bool b_overlap = false;
bool b_visited[26] = {false};
string str_RetVal("Everything is ok!");
int count = maze.size();
int n_DotCount = 0;


for(int i=0; i<count; i++)
{
string str_temp = maze[i];
int n_size_str_temp = str_temp.size();
for (int j=0; j<n_size_str_temp; j++)
{
if(str_temp[j] == '.') ++n_DotCount;
else if( str_temp[j]>='A' &&str_temp[j]<='Z')
{
if(b_visited[str_temp[j] - 'A' +1])
{
b_overlap = true;
}
else
{
b_visited[str_temp[j] - 'A' +1] = true;
}

}
}
}

if(n_DotCount<3)
{
str_RetVal = "There are less than 3 empty cells!";
return str_RetVal;
}

if(b_overlap)
{
str_RetVal = "There are at least two equal letters!";
return str_RetVal;
}

return str_RetVal;

}

};


int main(int argc, char* argv[])
{
vector <string> vs;
string s1("A.B");
vs.push_back(s1);
s1= "....." ;
vs.push_back(s1);
s1 = "B....";
vs.push_back(s1);
FirstMazeTask fm;
string srt = fm.checkCorrectness(vs);

//{"A..",
// "#.#",
// "#.B"}
//printf("Hello World!/n");
return 0;
}

分享到:
评论

相关推荐

    Top Coder中2K多个算法题Browser

    NULL 博文链接:https://john-doe.iteye.com/blog/2174546

    HDL-Coder详细教程

    HDL-Coder详细教程,有详细例子,源于官方例程,中文教程

    simulink hdl coder 用户手册pdf

    HDL CODER 的用户手册,学习hdl coder参考用书,详细介绍了用simulink开发fpga的过程

    phpcoder.rar

    phpcoder安装包。 直接下载安装即可。

    php coder编辑器

    PHPCoder用于快速开发和调试PHP应用程序,它很容易扩展和定制,完全能够符合开发者的个性要求.PHPCoder是一个非常实用的,功能强大的编程环境,而且它是免费的!

    MediaCoder答题器

    MediaCoder答题器

    Embedded Coder.rar

    texasinstrumentsc2000.mlpkginstall 支持TI的C2000系列工具包,要求MATLAB R2017a及其以上版本。 安装方法:打开matlab,调整路径到mlpkginstall文件所在目录;在current folder窗口里双击mlpkginstall文件即可开始...

    MediaCoder.5755专业破解版

    MediaCoder行业版一款针对VOD及KTV视频点播行业开发的,用于转换和处理带有多音轨内容的视频节目的软件。它具备业界领先的视频编码引擎,在高性能转码的同时保持高画质,并通过丰富的视频滤镜增强画面视觉效果。作为...

    matlab Embedded Coder Getting Started Guide.pdf

    Embedded Coder用于产生嵌入式处理器、目标快速原型板和大规模生产中使用的微处理器的可读的、紧凑的、快速的C和C++代码。Embedded Coder支持附加的MATLAB Coder™和Simulink Coder™配置选项,以及对生成代码的功能...

    MediaCoder64位专业破解版

    MediaCoder-Premium-x64 MediaCoder是最早开始使用GPU进行视频编码加速的影音转码软件之一。通过将原本完全依赖CPU的计算工作转移到GPU上进行,H.264和H.265编码所需的时间被大幅缩短。

    MediaCoder使用说明文档

    MediaCoder使用说明文档, mediaCoder usermanual,

    mediacoder专业版

    mediacoder 5685专业版,无普通版的限制

    range coder.pdf

    range coder, algorithm, compressing.

    coder的建表语句

    coder的建表语句

    MatlabCoder使用-Matlab Coder的基本使用.pdf

    MatlabCoder使用-Matlab Coder的基本使用.pdf 微盘资料搬家,自己写的,自己搬家. 请大家支持,点赞!谢谢!

    Mediacoder 使用帮助文档

    Mediacoder 入门使用说明+各种编码常用参数设置。

    BFSU_Qualitative_Coder_1.2.zip

    The file codelist.ini is the key and starting point of using qualitative coder. The codelist can be modified at any stage of your coding, but you are recommended to make change while you are ...

    Coder For VB,vb代码格式化

    Coder For VB is an add-in for Visual Basic 6.0 that provides tools to speedup the mundane parts of the development process, so you can concentrate on the more interesting parts. Coder For VB enables ...

    matlab coder基本函数教程

    matlab coder基本函数讲解,简要介绍了matlab coder 的使用

Global site tag (gtag.js) - Google Analytics