The choreography of tyvj1192 spring Prom

Source: Internet
Author: User

Background

HNSDFZ's classmates are going to rehearse a dance to celebrate the Spring Festival.

Describe

The performers rank in n rows, forming a forward triangle (on the screen, i.e. downward). And as for everyone, he might face forward (a small forward triangle), or a back triangle (a small backward positive triangle).
However, these people have obvious differences in clothing-part in winter uniforms and others in summer uniforms.
Now give everyone's clothing situation, please ask you to wear the summer school uniform the largest positive triangle, the output contains the number of people.

Input format

The first row is N.
Next n Row, the first row of 2*i-1 a valid character (' # ' or '-', respectively, the students wear winter uniforms or summer uniforms). A space appears in the input file, and the space is just to preserve the shape of the entire triangle.

Output format

Number of outputs.

Test Sample 1 input
5
#-##----#
-----#-
---#-
-#-
-
Output
9
Note

n<=100

Note that triangles can only face down.
#include <iostream>#include<cstdio>#include<string>#include<cstring>#include<algorithm>using namespacestd;Const intMAXN =505;intN,A[MAXN][MAXN],F[MAXN][MAXN],ANS,SUM[MAXN];intMain () {CIN>>N; Charcmd; sum[1] =1;  for(inti =1; I <= n;i++){         for(intL =1; l <=2* (n-i) +1; l++){            intj = i + L-1; scanf ("%c",&cmd);  while(cmd! ='-'&& cmd! ='#') scanf ("%c",&cmd); if(cmd = ='#') A[i][j] =1; ElseA[I][J] =2; }    }     for(inti =3; I <=2N1; i + =2) Sum[i] = sum[i-2] +i;  for(inti =1; I <= n;i++){         for(intL =1; l <=2* (n-i) +1; l++){            intj = i + L-1; if(A[i][j] = =2) F[i][j] =1; if(L &1)                 if(A[i][j] = =2&& a[i][j+1] ==2&& a[i][j+2] ==2&& a[i+1][j+1] ==2) F[i][j] =3; Ans=Max (ans,f[i][j]); }    }     for(intK =5; K <=2N1; k + =2){         for(inti =1; I <= n;i++){             for(intL =1; l <=2* (n-i) +1; l++){                intj = i + L-1; if((L &1) && F[i][j] >= K-2&& f[i][j+2] >= K-2&& f[i+1][j+1] >= K-2) {F[i][j]=K; Ans=Max (ans,k); } }}} cout<<Sum[ans]; return 0;} 

The choreography of tyvj1192 spring Prom

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.