QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#451140 | #1289. A + B Problem | 123886a123886 | Compile Error | / | / | C++14 | 467b | 2024-06-22 21:29:33 | 2024-06-22 21:29:33 |
Judging History
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 ;
}
詳細信息
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