QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#860216#9675. 电池检测Grain_Depot08Compile Error//C++14459b2025-01-18 11:21:182025-01-18 11:21:21

Judging History

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

  • [2025-01-18 11:21:21]
  • 评测
  • [2025-01-18 11:21:18]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int t,a,b;
int main(){
    scanf("%d",&t);
    while(t--){
        scanf("%d%d",&a,&b);
        if(a==2)printf("%d\n",(a+b)*(a+b-1)/2);
        else if(a==3){
            if(b==1)printf("2\n");
            else printf("%d\n",3+(a+b-3)*(a+b-4)/2);
        }else if(a>b){
            if(a>b+1)pritnf("%d\n",b+1);
            else printf("%d\n",a-2+(b-a+4)*(b-a+3)/2);
        }
    }
    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:13:22: error: ‘pritnf’ was not declared in this scope; did you mean ‘printf’?
   13 |             if(a>b+1)pritnf("%d\n",b+1);
      |                      ^~~~~~
      |                      printf
answer.code:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%d",&t);
      |     ~~~~~^~~~~~~~~
answer.code:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d%d",&a,&b);
      |         ~~~~~^~~~~~~~~~~~~~