QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#239048#7697. Impartial StringswillowCompile Error//C++171.5kb2023-11-04 18:14:302023-11-04 18:14:31

Judging History

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

  • [2023-11-04 18:14:31]
  • 评测
  • [2023-11-04 18:14:30]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

const int N = 1e3 + 5;

char A[N], s[N], t[N];

int la, ls, lt;

bool check() {
    if(t[0] != t[1]) {
        bool ok = 1;
        for(int i = 1; i < lt - 1; ++ i) ok &= (t[i] == t[i + 1]);
        if(!ok) return 0;

        // if(s[ls - 1] != t[0]) return 0;
        for(int i = 1; i < lt; ++ i) ok &= (t[i] == s[i - 1]);
        return ok;
    }
    bool ok = 1;
    for(int i = 0; i < lt - 2; ++ i) ok &= (t[i] == t[i + 1]);
    if(!ok) return 0;
    if(t[lt - 1] == t[lt - 2]) {
        return 0;
    }
    // if(s[0] != t[lt - 1]) return 0;
    for(int i = 0; i < lt - 1; ++ i) {
        if(s[ls - i - 1] != t[0])return 0;
    }
    return 1;
}

void rmain() {
    scanf("%s%s%s", A, s, t);
    la = strlen(A), ls = strlen(s), lt = strlen(t);
    bool ok = 1;
    for(int i = 0; i < strlen(fuck); ++ i) {
        ok &= (fuck[i] == s[i]);
    }
    int cnt = 0;

    if(ls < lt) {
        swap(ls, lt);
        swap(s, t);
    }

    for(int i = 0; i < ls - lt + 1; ++ i) {
        bool ok = 1;
        for(int j = 0; j < lt; ++ j) {
            ok &= (s[i + j] == t[j]);
        }
        if(ok) ++ cnt;
    }
    if(cnt > 1) {
        puts("1");
        return;
    }
    if(cnt == 1) {
        puts("1");
        return;
    }
    if(la > 2) {
        puts("0");
        return;
    }
    
    if(check()) {
        puts("1");
    } else puts("0");

}

int main() {
    int T;
    for(cin >> T; T --;) {
        rmain();
    }
}

Details

answer.code: In function ‘void rmain()’:
answer.code:37:31: error: ‘fuck’ was not declared in this scope
   37 |     for(int i = 0; i < strlen(fuck); ++ i) {
      |                               ^~~~
answer.code:34:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   34 |     scanf("%s%s%s", A, s, t);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~