QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#715808#6696. Three Dicelvliang#Compile Error//C++14867b2024-11-06 13:27:422024-11-06 13:27:43

Judging History

你现在查看的是最新测评结果

  • [2024-11-06 13:27:43]
  • 评测
  • [2024-11-06 13:27:42]
  • 提交

answer

#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;

bool a[4][20];
int num[] = { 2, 3, 5, 6 };

void dfs(int u, int x) {
    a[u][x] = true;
    if (u == 3) return;
    for (int i = 0; i < 4; i++) {
        dfs(u + 1, x + num[i]);
    }
}

int main() {
    int s, b;
    scanf("%d%d", &s, &b);
    if (b > 18 || a > 12) {
        puts("NO");
        return 0;
    }
    dfs(0, 0);
    if (s == 0) {
        if (a[3][b]) puts("YES");
        else puts("NO");
    } else if (s == 1 || s == 4) {
        if (a[2][b]) puts("YES");
        else puts("NO");
    } else if (s == 2 || s == 5 || s == 6) {
        if (a[1][b]) puts("YES");
        else puts("NO");
    } else if (a == 3 || a == 12 || a == 9) {
        if (a[0][b]) puts("YES");
        else puts("NO");
    } else puts("NO");
    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:20:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   20 |     if (b > 18 || a > 12) {
      |                   ~~^~~~
answer.code:34:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   34 |     } else if (a == 3 || a == 12 || a == 9) {
      |                ~~^~~~
answer.code:34:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   34 |     } else if (a == 3 || a == 12 || a == 9) {
      |                          ~~^~~~~
answer.code:34:39: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   34 |     } else if (a == 3 || a == 12 || a == 9) {
      |                                     ~~^~~~
answer.code:19:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |     scanf("%d%d", &s, &b);
      |     ~~~~~^~~~~~~~~~~~~~~~