답안 #122271

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
122271 2019-06-28T03:37:28 Z khulegub Aliens (IOI07_aliens) C++14
컴파일 오류
0 ms 0 KB
long long int read_int(){
	char r;
	bool start=false,neg=false;
	long long int ret=0;
	while(true){
		r=getchar();
		if((r-'0'<0 || r-'0'>9) && r!='-' && !start){
			continue;
		}
		if((r-'0'<0 || r-'0'>9) && r!='-' && start){
			break;
		}
		if(start)ret*=10;
		start=true;
		if(r=='-')neg=true;
		else ret+=r-'0';
	}
	if(!neg)
		return ret;
	else
		return -ret;
}

Compilation message

aliens.cpp: In function 'long long int read_int()':
aliens.cpp:6:5: error: 'getchar' was not declared in this scope
   r=getchar();
     ^~~~~~~
aliens.cpp:6:5: note: suggested alternative: 'char'
   r=getchar();
     ^~~~~~~
     char