编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#669 #996. 相似字符串 Compile Error 0 0 ms 0 K C / 485 B s230026187 2023-10-15 15:04:20
显示原始代码
#include <stdio.h>
#include <string.h>

int main() {
    int n;
    int result = 0;
    scanf("%d", &n);

    char str1[n + 1];
    scanf("%s", str1);
    char str2[n + 1];
    scanf("%s", str2);

    for (int i = 0; i < n; i++) {
        if (str1[i] == str2[i]) {
            continue;
        } else if (str1[i] == "l" && str2[i] == "1") {
            continue;
        } else if (str1[i] == "o" && str2[i] == "0") {
            continue;
        } else {
            result = 0;
        }
    }
    if (result == 0) {
        printf(''No\n'');
    } else {
        printf(''Yes\n'');
    }
    return 0
}

编译信息

/sandbox/1/a.c:18:18: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
                else if(str1[i]=="l"&&str2[i]=="1"){
                               ^ ~~~
/sandbox/1/a.c:18:18: warning: comparison between pointer and integer ('char' and 'char *') [-Wpointer-integer-compare]
                else if(str1[i]=="l"&&str2[i]=="1"){
                        ~~~~~~~^ ~~~
/sandbox/1/a.c:18:32: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
                else if(str1[i]=="l"&&str2[i]=="1"){
                                             ^ ~~~
/sandbox/1/a.c:18:32: warning: comparison between pointer and integer ('char' and 'char *') [-Wpointer-integer-compare]
                else if(str1[i]=="l"&&str2[i]=="1"){
                                      ~~~~~~~^ ~~~
/sandbox/1/a.c:21:18: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
                else if(str1[i]=="o"&&str2[i]=="0"){
                               ^ ~~~
/sandbox/1/a.c:21:18: warning: comparison between pointer and integer ('char' and 'char *') [-Wpointer-integer-compare]
                else if(str1[i]=="o"&&str2[i]=="0"){
                        ~~~~~~~^ ~~~
/sandbox/1/a.c:21:32: warning: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Wstring-compare]
                else if(str1[i]=="o"&&str2[i]=="0"){
                                             ^ ~~~
/sandbox/1/a.c:21:32: warning: comparison between pointer and integer ('char' and 'char *') [-Wpointer-integer-compare]
                else if(str1[i]=="o"&&str2[i]=="0"){
                                      ~~~~~~~^ ~~~
/sandbox/1/a.c:29:10: warning: empty character constant [-Winvalid-pp-token]
                printf(''No\n'');
                       ^
/sandbox/1/a.c:29:10: error: expected expression
/sandbox/1/a.c:29:16: warning: empty character constant [-Winvalid-pp-token]
                printf(''No\n'');
                             ^
/sandbox/1/a.c:32:10: warning: empty character constant [-Winvalid-pp-token]
                printf(''Yes\n'');
                       ^
/sandbox/1/a.c:32:10: error: expected expression
/sandbox/1/a.c:32:17: warning: empty character constant [-Winvalid-pp-token]
                printf(''Yes\n'');
                              ^
/sandbox/1/a.c:34:10: error: expected ';' after return statement
        return 0
                ^
                ;
12 warnings and 3 errors generated.