답안 #8588

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
8588 2014-09-17T16:16:37 Z yuioyuio 사회적 불평등 (TOKI14_social) C++
컴파일 오류
0 ms 0 KB
#include <cstdio>
#include <cmath>

int main () {
	int N;
	int L[111111];
	int P[111111];

	scanf("%d", &N);
	for (int i=0; i<N; i++) {
		scanf("%d %d", &L[i], &P[i]);
	}

	int sum=0;
	int c;
	for (int i=0; i<N-1; i++) {
		for (int j=i+1; j<N; j++) {
			c=abs(L[i]-L[j])*abs(P[i]-P[j]);
			sum+=c;
		}
	}
	printf("%d", sum);
	return 0;
}

Compilation message

social.cpp: In function 'int main()':
social.cpp:18:19: error: 'abs' was not declared in this scope
social.cpp:18:19: note: suggested alternative:
/usr/include/c++/4.6/cmath:96:5: note:   'std::abs'
social.cpp:9:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
social.cpp:11:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]