QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#231863#5434. Binary SubstringsinvernoCompile Error//C++14322b2023-10-29 17:21:412023-10-29 17:21:41

Judging History

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

  • [2023-10-29 17:21:41]
  • 评测
  • [2023-10-29 17:21:41]
  • 提交

answer

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

int main(){
    ios::sync_with_stdio(0); cin.tie(0);
	
    int n ;cin >> n;
	int w = log2(n);
	bool ch = 1;
	for (int i = 1;i <= n;i += w){
		for (int j = 1;j <= min(n-i+1,w);++ j) {
			if (ch) putw('0');
			  else putw('1');
		}
		ch^=1;
	}

    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:12:37: error: too few arguments to function ‘int putw(int, FILE*)’
   12 |                         if (ch) putw('0');
      |                                 ~~~~^~~~~
In file included from /usr/include/c++/11/cstdio:42,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:46,
                 from answer.code:1:
/usr/include/stdio.h:556:12: note: declared here
  556 | extern int putw (int __w, FILE *__stream);
      |            ^~~~
answer.code:13:36: error: too few arguments to function ‘int putw(int, FILE*)’
   13 |                           else putw('1');
      |                                ~~~~^~~~~
In file included from /usr/include/c++/11/cstdio:42,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:46,
                 from answer.code:1:
/usr/include/stdio.h:556:12: note: declared here
  556 | extern int putw (int __w, FILE *__stream);
      |            ^~~~