题目描述
本题为填空题,只需要算出结果后,在代码中使用输出语句将所填结果输出即可。
+-------------------------------------------------+
| |
| H###### #### |
| # # # |
| # # # |
| # #### # # |
| # # # # # |
| ######@### # # |
| # #### # # |
| # # # # # |
| ####@#######@### # # |
| # # # # # |
| T ##### # # # ## |
| # # ### ### ## |
| ################ # # #### |
| # # # # |
| ############## #######@########## |
| # ### |
| ########################### |
+-------------------------------------------------+
这题价值在于看看字符串怎么分行哈哈哈哈~
代码如下所示:
#include <iostream>
#include <cstring>
using namespace std;
const char* s="+-------------------------------------------------+\
| |\
| H###### #### |\
| # # # |\
| # # # |\
| # #### # # |\
| # # # # # |\
| ######@### # # |\
| # #### # # |\
| # # # # # |\
| ####@#######@### # # |\
| # # # # # |\
| T ##### # # # ## |\
| # # ### ### ## |\
| ################ # # #### |\
| # # # # |\
| ############## #######@########## |\
| # ### |\
| ########################### |\
+-------------------------------------------------+";
int main()
{
// 请在此输入您的代码
int len=strlen(s),res=0;
for(int i=0;i<len;++i)
{
if(s[i]=='#') ++res;
if(s[i]=='@') res+=2;
}
res+=2;
cout<<res;
return 0;
}