QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#182901#6750. CalculateKewuCompile Error//C++14553b2023-09-18 18:46:022023-09-18 18:46:02

Judging History

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

  • [2023-09-18 18:46:02]
  • 评测
  • [2023-09-18 18:46:02]
  • 提交

answer

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

const int N=5e3+10;

char Map[N];

int main()
{
    gets(Map+1);int n=strlen(Map+1);
    int ans=0;
    for(int i=1;i<=n;++i)
    {
        if(Map[i]!='?'&&(Map[i]<'0'||Map[i]>'9'))  continue;
        int flag=1;
        for(int j=1;j<i;++j)
            if(Map[j]=='-') flag=-flag;
        if(Map[i]=='?')
        {
            if(flag==1)
                ans+=9;
        }
        else    ans+=flag*(Map[i]-'0');
    }
    cout<<ans<<endl;
//    system("pause");
    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:10:5: error: ‘gets’ was not declared in this scope; did you mean ‘getw’?
   10 |     gets(Map+1);int n=strlen(Map+1);
      |     ^~~~
      |     getw