您的位置:首页 > 其它

GYM 101086 G.Paradise City(水~)

2017-03-23 15:42 363 查看
Description

给出一个3*3n的矩阵,表示n个3*3的旅馆,每个*表示一个四人间,问能居住人数最多的旅馆最多可以住多少人

Input

第一行一整数T表示用例组数,每组用例首先输入一整数n表示旅馆数量,之后n个3*3的矩阵表示每个旅馆(1<=T<=256,1<=n<=100)

Output

输出能居住人数最多的旅馆最多可以住多少人

Sample Input



Sample Output

24

16

28

Solution

水题

Code

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<ctime>
using namespace std;
typedef long long ll;
#define INF 0x3f3f3f3f
#define maxn 1111
char s[4][maxn];
int T,n;
int main()
{
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
scanf("%s%s%s",s[1]+1,s[2]+1,s[3]+1);
int ans=0;
for(int i=2;i<3*n;i+=3)
{
int temp=0;
for(int x=1;x<=3;x++)
for(int y=i-1;y<=i+1;y++)
if(s[x][y]=='*')temp+=4;
ans=max(ans,temp);
}
printf("%d\n",ans);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: