QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#335580#2921. Land EqualityamshaleCompile Error//C++201.3kb2024-02-23 16:30:462024-02-23 16:30:47

Judging History

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

  • [2024-02-23 16:30:47]
  • 评测
  • [2024-02-23 16:30:46]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

int main() {
    int rows,columns;
    scanf("%d",&rows);
    scanf("%d",&columns);
    int zeroes=0;
    int doubles=0;
    int freeones=0;
    int ones=0;
    int curr_num;
    for(int i=0;i<rows;i++){
        for(int j=0;j<columns;j++){
            scanf("%d",&curr_num);
            if(curr_num==0){
                zeroes++;
            }
            else if(curr_num==2){
                doubles++;
            }
            else{
            ones++;
            if((columns==1&&(i==0||i==rows-1))||rows==1&&(j==0||j==columns-1)){
                freeones++;
            }            
        }
    }
    }
    if((columns==1||rows==1)&&zeroes==1){
        if(freeones>0){
            printf("1\n");
            return 0;
        }else{
            printf("2\n");
            return 0;
        }
        
    }else if(zeroes==0){
        if(doubles%2==0){
            printf("0\n");
            return 0;
        }
        else{
            printf("%ld\n",long int(pow(2,(doubles/2))));
            return 0;
    }
    }
    else if(zeroes==1){
        if(ones>0){         
            printf("1\n");
        }
        else{
            printf("2\n");
    }
    }
    else{
        printf("0\n");
    }
    return 0;
}

详细

answer.code: In function ‘int main()’:
answer.code:46:28: error: expected primary-expression before ‘long’
   46 |             printf("%ld\n",long int(pow(2,(doubles/2))));
      |                            ^~~~
answer.code:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     scanf("%d",&rows);
      |     ~~~~~^~~~~~~~~~~~
answer.code:8:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     scanf("%d",&columns);
      |     ~~~~~^~~~~~~~~~~~~~~
answer.code:16:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |             scanf("%d",&curr_num);
      |             ~~~~~^~~~~~~~~~~~~~~~