QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#191195#7534. KPI CalculationDays_of_Future_Past#Compile Error//C++14438b2023-09-29 20:16:072023-09-29 20:16:07

Judging History

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

  • [2023-09-29 20:16:07]
  • 评测
  • [2023-09-29 20:16:07]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N = 1001111;
int main(){
	static char st[N];
	int ans = 0;
	for(;;) {
		if(gets(st) == NULL) {
			break;
		}
		int pos = -1;
		int len = strlen(st);
		int cnt = 0;
		for(int i = 0; i < len; i++) {
			if(st[i] == ' ') {
				cnt++;
			}
			if(st[i] > ' ') {
				pos = i;
				break;
			}
		}
		if(pos != -1) {
			ans += cnt;
		}
	}
	printf("%d\n", ans);
}


Details

answer.code: In function ‘int main()’:
answer.code:8:20: error: ‘gets’ was not declared in this scope; did you mean ‘getw’?
    8 |                 if(gets(st) == NULL) {
      |                    ^~~~
      |                    getw