답안 #510293

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
510293 2022-01-14T22:28:39 Z salamhassan Tetris (COCI17_tetris) C++14
80 / 80
0 ms 208 KB
#include <bits/stdc++.h>
using namespace std;
char a[12][12];
int ans[6],n,m;
int main()
{
    cin>>n>>m;
    for (int i=0; i<n; i++)
    {
        for (int j=0; j<m; j++)
        {
            cin>>a[i][j];
        }
    }
    for (int i=0; i<n; i++)
    {
        for (int j=0; j<m; j++)
        {

             if (a[i][j]!='.')
                {
                    if (a[i][j+1]==a[i][j] && a[i][j+2]==a[i][j] && a[i][j+3]==a[i][j])
                    {
                    ans[2]++;
                    }
                    
                    if (a[i+1][j]==a[i][j] && a[i+2][j]==a[i][j] && a[i+3][j]==a[i][j])
                    {
                    ans[2]++;
                    }
                    
                    if (a[i][j+1]==a[i][j] && a[i+1][j]==a[i][j] && a[i+1][j+1]==a[i][j])
                    {
                    ans[1]++;

                    }
                    if (a[i][j+1]==a[i][j] && a[i+1][j]==a[i][j] && a[i+1][j-1]==a[i][j])
                    ans[3]++;
                    if (a[i+1][j]==a[i][j] && a[i+1][j+1]==a[i][j] && a[i+2][j+1]==a[i][j])
                    ans[3]++;
                    if (a[i][j+1]==a[i][j] && a[i+1][j+1]==a[i][j] && a[i+1][j+2]==a[i][j])
                    ans[4]++;
                    if (a[i+1][j]==a[i][j] && a[i+1][j-1]==a[i][j] && a[i+2][j-1]==a[i][j])
                    ans[4]++;
                    if (a[i][j+1]==a[i][j] && a[i][j+2]==a[i][j] && a[i-1][j+1]==a[i][j])
                    ans[5]++;
                    if (a[i+1][j]==a[i][j] && a[i+2][j]==a[i][j] && a[i+1][j+1]==a[i][j])
                    ans[5]++;
                    if (a[i-1][j+1]==a[i][j] && a[i][j+1]==a[i][j] && a[i+1][j+1]==a[i][j])
                    ans[5]++;
                    if (a[i][j+1]==a[i][j] && a[i][j+2]==a[i][j] && a[i+1][j+1]==a[i][j])
                    ans[5]++;

                }
            }

        }
for (int i=1; i<=5; i++)
    cout<<ans[i]<<endl;
    return 0;
}

Compilation message

tetris.cpp: In function 'int main()':
tetris.cpp:58:1: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   58 | for (int i=1; i<=5; i++)
      | ^~~
tetris.cpp:60:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   60 |     return 0;
      |     ^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct