编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#30809 #1010. J. 团队配置,新奇的面试题 Compile Error 0 0 ms 0 K C++ / 1.1 K skystar 2020-07-03 17:15:44
显示原始代码
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
    int T, N, M, n, m = 0;
    int bloom = 0;
    char mo[50][50], fl[50][50];
    scanf("%d", &T);
    while (T--) {
        scanf("%d%d", &N, &M);
        for (int i = 0; i < N; i++) scanf("%c,", &mo[i]);
        scanf("%d%d", &n, &m);
        for (int i = 0; i < n; i++) scanf("%c,", &fl[i]);
        bool flag = true;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                flag = true;
                int a = i - (n - 1) / 2;
                int b = j - (m - 1) / 2;
                for (int k = max(0, a); k <= min(N - 1, i + (n - 1) / 2); k++) {
                    for (int p = max(0, b); k <= min(M - 1, j + (m - 1) / 2); k++) {
                        if (!flag)
                            break;
                        if (mo[k][p] == '#' && fl[k - i + (n - 1) / 2][p - j + (m - 1) / 2] == '#')
                            flag = false;
                    }
                }
                if (flag)
                    bloom++;
            }
        }
        printf("%d", bloom);
        // system("pause");
    }

编译信息

/sandbox/1/a.cpp: In function 'int main()':
/sandbox/1/a.cpp:14:19: warning: format '%c' expects argument of type 'char*', but argument 2 has type 'char (*)[50]' [-Wformat=]
             scanf("%c,",&mo[i]);
                   ^~~~~ ~~~~~~
/sandbox/1/a.cpp:17:19: warning: format '%c' expects argument of type 'char*', but argument 2 has type 'char (*)[50]' [-Wformat=]
             scanf("%c,",&fl[i]);
                   ^~~~~ ~~~~~~
/sandbox/1/a.cpp:43:5: error: expected '}' at end of input
     }
     ^
/sandbox/1/a.cpp:5:1: note: to match this '{'
 {
 ^
/sandbox/1/a.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&T);
     ~~~~~^~~~~~~~~
/sandbox/1/a.cpp:12:13: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
        scanf("%d%d",&N,&M);
        ~~~~~^~~~~~~~~~~~~~
/sandbox/1/a.cpp:14:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%c,",&mo[i]);
             ~~~~~^~~~~~~~~~~~~~
/sandbox/1/a.cpp:15:13: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
        scanf("%d%d",&n,&m);
        ~~~~~^~~~~~~~~~~~~~
/sandbox/1/a.cpp:17:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%c,",&fl[i]);
             ~~~~~^~~~~~~~~~~~~~