QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#451140#1289. A + B Problem123886a123886Compile Error//C++14467b2024-06-22 21:29:332024-06-22 21:29:33

Judging History

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

  • [2024-06-22 21:29:33]
  • 评测
  • [2024-06-22 21:29:33]
  • 提交

answer

#include<bits/stdc++.h> 
using namespace std;
const int MAXN=1e6+50; 
int ans[MAXN] ;
char str[MAXN] ;
void sol() {
	int n,m,len;scanf("%d%d",&n,&m) ;len=n+m;
	scanf("%s",str+1) ;
	memset(ans,0,sizeof(int)*(len+1)) ;
	if(n<m) swap(n,m) ;
	int lst=m,c=0;for(int i=1;i<=m;++i) c+=(str[i]=='0') ;
	while(lst<len) {
		if(str[lst+1]=='1') {
			lst++;continue;
		}
		if(c<=len-(lst+1)||c==m) break;
		else lst++,c++;
	}
	//[1,c],[c+1,len]
	
	return ;
}

Details

answer.code: In function ‘void sol()’:
answer.code:7:26: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         int n,m,len;scanf("%d%d",&n,&m) ;len=n+m;
      |                     ~~~~~^~~~~~~~~~~~~~
answer.code:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%s",str+1) ;
      |         ~~~~~^~~~~~~~~~~~
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status