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
给出一个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; }
相关文章推荐
- GYM 101086 A.My Friend of Misery(水~)
- GYM 101086 B.Brother Louie(dfs)
- GYM 101086 C.Everything(字典树)
- GYM 101086 D.Secure but True(水~)
- GYM 101086 F.Hey JUDgE(枚举)
- Gym 101086 A, L ,G,H ,F 题解
- GYM 101086 H.Another Square in the Floor(水~)
- GYM 101086 J.Smooth Developer(dfs)
- GYM 101086 K.Betrayed(树形DP+概率DP)
- Gym 101086 A,F,G,H,L 五个水题
- GYM 101086 L.Chance(水~)
- GYM 101086 M.ACPC Headquarters : AASTMT (Stairway to Heaven)(map)
- Gym 101086 M ACPC Headquarters : AASTMT (Stairway to Heaven)
- Codeforces GYM 100548 F - Color 2014-2015 ACM-ICPC, Asia Xian Regional Contest
- Codeforces Gym 100676G Training Camp 状压dp
- codeforces Gym 100187B B. A Lot of Joy
- Gym 100712G Heavy Coins(dfs)
- Codeforces Gym 100637A A. Nano alarm-clocks 前缀和
- codeforce Gym 100500I Hall of Fame (水)
- Gym 100703L Many questions 水题