제출 #503326

#제출 시각아이디문제언어결과실행 시간메모리
503326rainboyKućice (COCI21_kucice)C11
40 / 110
3 ms280 KiB
#include <stdio.h>

#define N	100
#define MD	1000000007

int pp2[N + 1];

void init() {
	int i;

	pp2[0] = 1;
	for (i = 1; i <= N; i++)
		pp2[i] = pp2[i - 1] * 2 % MD;
}

int xx[N], yy[N];

long long cross(int i, int j, int k) {
	return (long long) (xx[j] - xx[i]) * (yy[k] - yy[i]) - (long long) (xx[k] - xx[i]) * (yy[j] - yy[i]);
}

int main() {
	int n, i, j, k, ans;

	init();
	scanf("%d", &n);
	if (n > N) {
		printf("%lld\n", (long long) pp2[n - 1] * n % MD);
		return 0;
	}
	for (i = 0; i < n; i++)
		scanf("%d%d", &xx[i], &yy[i]);
	ans = (long long) (pp2[n] - 1) * n % MD;
	for (i = 0; i < n; i++)
		for (j = 0; j < n; j++)
			if (j != i) {
				int cnt = 0;

				for (k = 0; k < n; k++)
					if (k != i && cross(i, j, k) < 0)
						cnt++;
				ans = (ans - pp2[cnt] + MD) % MD;
			}
	printf("%d\n", ans);
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

Main.c: In function 'main':
Main.c:26:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
Main.c:32:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |   scanf("%d%d", &xx[i], &yy[i]);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...