Top coder competition May 26th,2007
来源:互联网 发布:mysql 5.7.20.tar.gz 编辑:程序博客网 时间:2024/05/17 16:46
My code as below for the first item:
#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 competition May 26th,2007
- Baidu A Star 2007 competition May 26
- Baidu A Star 2007 competition May 27
- [转]Prize winner in Competition "Best C++/MFC article of May 2007"
- 26th-30th April Summary && 1st-5th May Plan
- May 10th
- top coder srm349(2007-05-16 01:08)
- 2008 May 26th Monday (五月 二十六日 月曜日)
- May 26th Tuesday (五月 二十六日 火曜日)
- top coder试玩心得
- TOP CODER SRM 611 DIV2
- Competition
- 1st-5th May Summary && 6th-10th May Plan
- Top Coder SRM 614 DIV 2
- May 7th Monday (五月 七日 月曜日)
- May 8th Tuesday (五月 八日 火曜日)
- May 9th Wednesday (五月 九日 水曜日)
- May 16th Wednesday (五月 十六日 水曜日)
- 走近所罗门 Part 2:初见所罗门
- Filter开发过程中的注意事项
- IE 取得打开网页中的所有email地址源码
- 如何在Linux下实现设备的配置(上)
- STL里的multimap使用简介
- Top coder competition May 26th,2007
- oracle中的exists
- 统计别人是如何进入我的网站的
- 大阪第70天——世乒赛的转播
- 贾金斯式的人永远不会成功
- Oracle的解惑一二to_date()与24小时制表示法及mm分钟的显示
- 阿翔编程学-爱情感言
- 《唐伯虎点秋香》中的超级对联
- Baidu A Star 2007 competition May 26